Created
February 17, 2015 02:17
-
-
Save CreaturePhil/adc83bd1171345100d1a 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
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