title: Express: how to pass variables to mounted middleware
body: <p>I've just started to play around with Expressjs and I'm wondering how to pass variables to mounted middleware/sub application. In the following example, I'd like the config object passed to my /blog/index</p>
  
  <p>in app.js</p>
  
  <pre><code>var express = require('express');
  var app = express();
  //...
  var config = {}
  //...
  app.use('/blog', require('./blog/index')
  </code></pre>
  
  <p>in /blog/index.js</p>
  
  <pre><code>var express = require('express');
  app = module.exports = express();
  
  app.use(express.static(...
  app.get('/', function(req, res, next) {
    //handle the req and res
  }
  </code></pre>
  
  <p>Thanks,</p>