Nodejs backbone restful related issues. Seek guidance

  node.js, question

I want to use backbone plus nodejs plus mysql to create a very simple address book.

In the process of practice, you have already connected to mysql using nodejs and then met the following questions?
1. How to return the data by interface (completed)
2. How to control the addition, deletion, checking and modification of data in js (completed)
3. Are there any rules for writing the data layer of 3.backbone (completed)

I also found that there is very little related knowledge on the internet and I don’t have much experience in the back end. if anyone has any related tutorials, please provide them.
Thank you for your help. The above problems have been largely solved.

However, we have encountered new problems.
When using backbone and then following RESTful rules to save data, nodejs cannot obtain the data. Please see the following for the specific code:
Front end:

//Add and Query
 newPhone.create({
 Name:' Li moumou',
 phone : '12356125'
 },{
 success : function(Collection,resp){
 console.log(Collection.models)
 bracket
 })

Back end:

. post(function(req,res,next){ // increased
 if (req.method === "POST") {
 console.log(req.params)    // {}
 console.log(req.body)      // undefined
 console.log(req.query)     // {}
 //Unable to obtain the transmitted data
 
 res.jsonp({
 return : false
 })
 
 //Originally, the parsing method of get was used
 // var pathname = req.params['0'],
 //  name = pathname.split("/")[0],
 //  phone = pathname.split("/")[1];
 
 // model.addAddress(name, phone, function(data) {
 
 //  if (data) {
 //      res.jsonp(data)
 //  }
 // })
 }else{
 next();
 bracket
 })

Request

clipboard.png

How to use the interface to return data?

According to MVC pattern, the interface actually uses route analysis to parse the url to a controller (route rule), and can write one by itself, which is very interesting. Of course, this lower-level encapsulation is completely unnecessary, because node web frameworks such as Connect Express are already in place.

It is also recommended to use Restful API so that all requests can be resolved according to web method. All requests are resources and are very standard.

Js Control Data Add, Delete, Revise and Check

There is a special library to operatehttps://github.com/dresende/node-orm2

Backbone data layer writing rules

-no