Created
March 24, 2015 14:26
-
-
Save alexpersian/cbb4d1e86ced87db92cd 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
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