Skip to content

Commit c3f2868

Browse files
committed
Add GET /todos route
1 parent 3641577 commit c3f2868

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

server/server.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ app.post('/todos', (req, res) => {
2121
});
2222
});
2323

24+
app.get('/todos', (req, res) => {
25+
Todo.find().then((todos) => {
26+
res.send({todos});
27+
}, (e) => {
28+
res.status(400).send(e);
29+
});
30+
});
31+
2432
app.listen(3000, () => {
2533
console.log('Started on port 3000');
2634
});

server/tests/server.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ describe('POST /todos', () => {
2525
if (err) {
2626
return done(err);
2727
}
28-
2928
Todo.find().then((todos) => {
3029
expect(todos.length).toBe(1);
3130
expect(todos[0].text).toBe(text);

0 commit comments

Comments
 (0)