Accessing res.locals after app.router
问题 I am creating the middleware to be called after app.router and I need to access the data that was stored in res.locals object by the route middleware and route handler. //... app.use(app.router); app.use(myMiddleware); //... app.get('/', function(req, res) { res.locals.data = 'some data'; }); function myMiddleware(req, res, next) { if (res.locals.data) console.log('there is data'); else console.log('data is removed'); // that's what happens } The problem is that all properties of res.locals