title: Express: passing options to an included server
body: <p>I would like to develop an Express website that can run either stand-alone or as part of a larger server while allowing a degree of configuration.</p>
  
  <p>For example, say I have a large main server in <code>server.js</code> and I write another server <code>app.js</code> that defines a route <code>/*</code> to provide a small service. I want to be able to either:</p>
  
  <ul>
  <li>run <code>app.js</code> standalone, which will provide its routes through <code>localhost:port/</code></li>
  <li>define a route within <code>server.js</code> that maps to this server, for example so that <code>/app/*</code> will allow <code>app.js</code> to handle requests.</li>
  </ul>
  
  <p>Reading through <em>Smashing Node</em>, I see that if I define an Express server and its routes in <code>app.js</code>, I can use: <code>server.use('/app', require('app.js')</code> to gain use of its routes. The problem with this approach is that I do not see how to pass any configuration options to <code>app.js</code>.</p>