Skip to content

Commit cbf5366

Browse files
committed
DELETE /todos/:id
1 parent 00dafe4 commit cbf5366

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

routes/todos.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,12 @@ router.put('/:id', function(req, res, next) {
3636
});
3737
});
3838

39+
/* DELETE /todos/:id */
40+
router.delete('/:id', function(req, res, next) {
41+
Todo.findByIdAndRemove(req.params.id, req.body, function (err, post) {
42+
if (err) return next(err);
43+
res.json(post);
44+
});
45+
});
46+
3947
module.exports = router;

0 commit comments

Comments
 (0)