You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
router.get('/todo', function(req, res, next){
res.send(todoList);
res.end();
});
//create a todo list
router.post('/todo', function(req, res, next){
var id = counter += 1;//todo list id
todoList[id] = req.params();
res.send(counter.toString());
res.end();
});
router.delete('/todo/:id', function(req, res, next){
var id = req.params('id');//todo list id
todoList[id] = undefined;
res.redirect('/todo');//想要重導回router.get('/todo,function(){}')
});
The text was updated successfully, but these errors were encountered:
目的
node 在做route的時候遇到一個問題
使用的工具
node.js express4
遇到的問題
不知道res.redirect()要怎麼寫才能重導到router.get('/todo'
程式碼
The text was updated successfully, but these errors were encountered: