The textbook todo.allreturns an object callback. This is required for syntax router.get.
From the documentation:
router.METHOD (path callback, [callback, ...])
router.METHOD() Express, METHOD HTTP, GET, PUT, POST .., . , router.get(), router.post(), router.put() ..
- callback todo, callback router.
, todo.js callback ( , todo.all):
module.exports = {
all: function(req, res){
res.send('All todos')
},
viewOne: function(req, res){
console.log('Viewing ' + req.params.id);
},
create: function(req, res){
console.log('Todo created')
},
destroy: function(req, res){
console.log('Todo deleted')
},
edit: function(req, res){
console.log('Todo ' + req.params.id + ' updated')
}
};