Skip to content

Commit 00dafe4

Browse files
committed
Update: PUT /todos/:id
1 parent 7d8bc67 commit 00dafe4

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
@@ -28,4 +28,12 @@ router.get('/:id', function(req, res, next) {
2828
});
2929
});
3030

31+
/* PUT /todos/:id */
32+
router.put('/:id', function(req, res, next) {
33+
Todo.findByIdAndUpdate(req.params.id, req.body, function (err, post) {
34+
if (err) return next(err);
35+
res.json(post);
36+
});
37+
});
38+
3139
module.exports = router;

0 commit comments

Comments
 (0)