Created
October 6, 2014 09:15
-
-
Save skyserpent/d52ce1e7ceff5aaad417 to your computer and use it in GitHub Desktop.
This file contains 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 characters
/** | |
* Create a Contact | |
*/ | |
exports.create = function(req, res) { | |
var contact = new Contact(req.body), | |
user = req.user; | |
user.contacts.push(contact); | |
user.save(function(err) { | |
if (err) { | |
return res.status(400).send({ | |
message: errorHandler.getErrorMessage(err) | |
}); | |
} else { | |
res.jsonp(user); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment