-
-
Save ssube/a5a55a9e83fb8cf67bf0 to your computer and use it in GitHub Desktop.
Revisions
-
ssube revised this gist
Mar 1, 2016 . 1 changed file with 7 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,8 @@ validateRegister(req.body).then(function(){ return db.createUser(req.body.name, req.body.email, req.body.password); }).then(function(newUser){ console.log(2); res.send({state: 'success', name: newUser.name}); }).catch(function(err){ res.send(500); }); -
Technoash created this gist
Mar 1, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ validateRegister(req.body) .then(function(errors){ if(errors.count > 0){ res.send({state: 'failure', registerFormErrors: errors.messages, errorCount: errors.count}); return; } db.createUser(req.body.name, req.body.email, req.body.password) .then(function(newUser){ console.log(2); res.send({state: 'success', name: newUser.name}); }) .catch(function(err){ //catch 1 throw err; }); }) .catch(function(err){ //catch 2 console.log(err); res.status(500); });