Skip to content

Instantly share code, notes, and snippets.

@skyserpent
Created October 6, 2014 09:15
Show Gist options
  • Save skyserpent/d52ce1e7ceff5aaad417 to your computer and use it in GitHub Desktop.
Save skyserpent/d52ce1e7ceff5aaad417 to your computer and use it in GitHub Desktop.
/**
* 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