Skip to content

Instantly share code, notes, and snippets.

@CreaturePhil
Created February 17, 2015 02:17
Show Gist options
  • Save CreaturePhil/adc83bd1171345100d1a to your computer and use it in GitHub Desktop.
Save CreaturePhil/adc83bd1171345100d1a to your computer and use it in GitHub Desktop.
router.post('/', function(req, res) {
if (!req.body.title || !req.body.text) {
return res.redirect('/');
}
var post = new Post({
title: req.body.title,
text: req.body.text,
date: (new Date())
});
post.save(function(err) {
res.redirect('/');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment