Skip to content

Commit 28b60c4

Browse files
committed
Create: POST /todos
1 parent 54ab912 commit 28b60c4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

routes/todos.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,12 @@ router.get('/', function(req, res, next) {
1212
});
1313
});
1414

15+
/* POST /todos */
16+
router.post('/', function(req, res, next) {
17+
Todo.create(req.body, function (err, post) {
18+
if (err) return next(err);
19+
res.json(post);
20+
});
21+
});
22+
1523
module.exports = router;

0 commit comments

Comments
 (0)