aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'controllers')
-rw-r--r--controllers/post.js4
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('/'));
}
};