Skip to content

Commit

Permalink
Update: PUT /todos/:id
Browse files Browse the repository at this point in the history
  • Loading branch information
amejiarosario committed Oct 2, 2014
1 parent 7d8bc67 commit 00dafe4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions routes/todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ router.get('/:id', function(req, res, next) {
});
});

/* PUT /todos/:id */
router.put('/:id', function(req, res, next) {
Todo.findByIdAndUpdate(req.params.id, req.body, function (err, post) {
if (err) return next(err);
res.json(post);
});
});

module.exports = router;

0 comments on commit 00dafe4

Please sign in to comment.