在使用 Express
时,我的路线如下:
app.get('*', function (req, res, next) {
// no route is matched
// so call next() to pass to the static middleware
next();
});
还有另一条路线,类似于 app.get('/myroute', function(req, res, next)...
我可以通过 next
将信息从第一个路由传递到该路由吗?
最佳答案
谢谢@amakhrov。我可以使用 res.locals
并存储信息。
关于node.js - 我可以通过 Express 中的下一个函数传递数据吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18289779/