有什么方法可以访问发送到任何路由的请求对象,而不用.get或类似的方法访问它,而是访问发送给全局表达的任何请求?
Yes. That's the most of the point of middleware.
Quoting from the documentation :
var requestTime = function (req, res, next) { req.requestTime = Date.now() next() } app.use(requestTime)
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.