0
我試圖讓動態路由像/審查 - {TITLE} - {ID} ,但造成的錯誤,不知道爲什麼,此外,如果用戶輸入了錯誤的PARAMS不是如何處理那個。 我的客戶要求就像上面那樣,我不擅長節點並且表達任何人都建議如何製作像上面這樣的路線。 另外,如果我需要製作像這樣的/ review /:title /:id格式的路線,那我怎麼能這樣做。請在節點動態路徑,並表示JS
我想,但它重定向我出到404頁,
請裏面找到我的現有代碼的細節, server.js
this is working..
app.get('/review', (req, res) => {
res.sendFile(path.resolve(__dirname, '../client/review.html'));
});
but not this one..
app.get('/review-*-*', (req, res) => {
res.sendFile(path.resolve(__dirname, '../client/review.html'));
});
Also not this one working
app.get('/review/*/*', (req, res) => {
res.sendFile(path.resolve(__dirname, '../client/review.html'));
});
This is 404 page which call evrytime while accessing dynamic pages
app.get('/*', (req, res) => {
res.sendFile(path.resolve(__dirname, '../client/404.html'));
});
您可能感興趣的是:。http://stackoverflow.com/questions/25623041/how-to-configure-dynamic-路線與 - 快遞-JS – DrakaSAN