我可以通过 Express 中的 next 函数传递数据吗?

Sha*_*oon 2 node.js express

在使用中Express,我有一条路线,如:

app.get('*', function (req, res, next) {
  // no route is matched
  // so call next() to pass to the static middleware
  next();
});
Run Code Online (Sandbox Code Playgroud)

还有一条类似的路线 app.get('/myroute', function(req, res, next)...

我可以将信息从第一个 via 传递到该路由next吗?

Sha*_*oon 5

谢谢@amakhrov。我可以使用res.locals和存储信息。