title: Communication between middleware and route in keystonejs
body: <p>I am using keystone and I have productDetail route in which I can add variables in res.locals to be used in templates. Is there a way I can use res.locals (of route file) in middleware.js file? As right now middleware is executing before route, I want route file to be executed first.</p>
  
  <p>This is where middleware is executing in index.js file</p>
  
  <pre><code>keystone.pre('routes', middleware.initLocals);
  </code></pre>
  
  <p>And after that we have </p>
  
  <pre><code>exports = module.exports = function(app) {
    // Views
    app.get('/', routes.views.index);
    app.get('/product-detail/:product', routes.views.productDetails);
  }
  </code></pre>