From 349c45a4589814f145b2f509a1f2c676e71d2706 Mon Sep 17 00:00:00 2001 From: Divyanshu Rathore Date: Mon, 24 Sep 2018 19:32:44 +0530 Subject: [PATCH] Adds GET /todos route --- server/server.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/server.js b/server/server.js index f4b05ab..afa92a8 100644 --- a/server/server.js +++ b/server/server.js @@ -21,6 +21,12 @@ app.post('/todos', (req, res) => { }); }); +app.get('/todos', (req, res) => { + Todo.find().then((todos) => { + res.send({todos}); + }, (e) => res.status(400).send(e)); +}); + app.listen(3000, () => { console.log('Started on port: 3000'); });