aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/routes.js11
1 files changed, 3 insertions, 8 deletions
diff --git a/app/routes.js b/app/routes.js
index 7b596dc..724af11 100644
--- a/app/routes.js
+++ b/app/routes.js
@@ -1,18 +1,15 @@
// get the todos collection
var todoCollect = require('./models/todo');
-
// use mongo to get all the items in db
function getTodos (res) {
todoCollect.find(function (err, todos) {
if (err) res.send(err);
-
- res.json(todos); // return all todos in JSON format
- // console.log(todos);
+ // return all todos in JSON format
+ res.json(todos);
});
}
-
// ===========================API===============================
module.exports = function (app) {
@@ -30,7 +27,6 @@ module.exports = function (app) {
done: false
}, function (err, todo) {
if (err) res.send(err);
-
// 'refresh' to-do list
getTodos(res);
});
@@ -43,7 +39,6 @@ module.exports = function (app) {
_id: req.params.todo_id
}, function (err, todo) {
if (err) res.send(err);
-
// 'refresh' to-do list
getTodos(res);
});
@@ -53,4 +48,4 @@ module.exports = function (app) {
app.get('*', function (req, res) {
res.sendFile(__dirname + '/public/index.html');
});
-}; \ No newline at end of file
+};