app.get('*', function (req, res) {
res.redirect('/myPage');});
This code I have added to end of the main.js. However, this code is handling even the routes defined above in the file.
Got it working by taking app.use(router) to top. It was previously below my code. I don't know why it happened but now its working fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.