-1
我想路由在nodeJS中以斜線格式化的URL。我想這一點:Router.js不會路由
但是,當轉到頁面時,我得到了沒有找到我404,爲什麼呢?
這裏是我的代碼:
router.get('/a'), function(req, res, next) {
res.send('Whatever you wish to send \n');
}
我想路由在nodeJS中以斜線格式化的URL。我想這一點:Router.js不會路由
但是,當轉到頁面時,我得到了沒有找到我404,爲什麼呢?
這裏是我的代碼:
router.get('/a'), function(req, res, next) {
res.send('Whatever you wish to send \n');
}
不知道你正在使用的框架,我覺得你的語法是錯誤的。
恕我直言,它應該是:
router.get('/a', function(req, res, next) {
res.send('Whatever you wish to send \n');
})
這是一個router.js路線,而不是表達 – Errors11
你需要指定端口? '80'通常會給你一個不同的錯誤,除非你在'sudo'下運行它,也許你需要到'localhost:8080/a',其中'8080'是你使'router'監聽的端口號。 –
這不是因爲localhost:80完美運作。但是localhost:80/a不起作用。 – Errors11