##Client Request##
The following is a post request sent by a user during the registration process
POST /api/create_user HTTP/1.1
Accept: application/json
Content-Type: application/json;charset=UTF-8
Host: localhost
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 2103
first_name=Ken&last_name=Johnson&password=lolcats&password_confirmation=lolcats&[email protected]
##Web Application##
The following code is used by the application to process the new user's request. The application code takes the body of the POST request req.body
and instantiates a new user model object new User()
with them. Any parameters submitted by the user are converted into database attributes and values.
var user = new User(req.body);
user.save();