Skip to content

Instantly share code, notes, and snippets.

@alexpersian
Created March 24, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexpersian/cbb4d1e86ced87db92cd to your computer and use it in GitHub Desktop.
Save alexpersian/cbb4d1e86ced87db92cd to your computer and use it in GitHub Desktop.
app.post('/api/posts', function(req, res) {
var post = new Post();
post.name = req.body.name;
post.desc = req.body.desc;
post.quantity = req.body.quantity;
post.time = new Date();
post.save(function(err) {
if (err) {
res.send(err);
}
res.json({ message: 'Post created!' });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment