diff options
Diffstat (limited to 'controllers')
-rw-r--r-- | controllers/post.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/controllers/post.js b/controllers/post.js index 7c66dec..d879fcc 100644 --- a/controllers/post.js +++ b/controllers/post.js @@ -25,6 +25,10 @@ module.exports = { 'text': req.body.text }); newPost.save().then(() => res.redirect('/')); + }, + + destroy(req, res) { + Post.findByIdAndRemove(req.params.id).then(() => res.redirect('/')); } }; |