diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-12 19:08:52 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-12 19:08:52 +0100 |
| commit | 1d38c91fbc8aed5b909c0ce9f60014b219fe792a (patch) | |
| tree | 77bd83d30597e03c84805c17d8176b4c770cf88e /bucky/app | |
| parent | 64c4a75529db6c2129fbcde2b1b63a44d4a45fb4 (diff) | |
delete and reply
Diffstat (limited to 'bucky/app')
| -rw-r--r-- | bucky/app/bucky.js | 3 | ||||
| -rw-r--r-- | bucky/app/router.js | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js index 5fb58bf..47ad187 100644 --- a/bucky/app/bucky.js +++ b/bucky/app/bucky.js @@ -530,4 +530,7 @@ var bucky = module.exports = { next() }) }, + destroyMessage: function(req, res, next) { + res.message.destroy().then( () => next() ) + }, }
\ No newline at end of file diff --git a/bucky/app/router.js b/bucky/app/router.js index 56e1f36..7fbf479 100644 --- a/bucky/app/router.js +++ b/bucky/app/router.js @@ -301,8 +301,14 @@ module.exports = function(app){ bucky.deleteDraft, function(req, res){ res.json({ status: "ok" }) - } - ) + }) + app.delete("/api/message/:id", + middleware.ensureAuthenticated, + bucky.ensureMessage, + bucky.destroyMessage, + function(req, res){ + res.json({ status: "ok" }) + }) auth.route(app) } |
