title: How to set vhost in Expressjs without hard coding?
body: <p>So i know this works:</p>
  
  <pre><code>app.use(express.vhost('sub.xyz.com', subdomainApp));
  app.use(express.vhost('xyz.com', mainApp));
  </code></pre>
  
  <p>But when i try set the host part in express.vhost dynamically, it simply doesn't work. (I need to set it dynamically in order to avoid changing the hard coded domains while i move between production and development.)</p>
  
  <p>I tried the code below and i dont know why this doesn't work:</p>
  
  <pre><code>app.use(function(req, res){ return express.vhost('xyz.'+req.host, subdomainApp); });
  app.use(function(req, res){ return express.vhost(req.host, mainApp); });
  </code></pre>
  
  <p>So how do i pass 'request host' dynamically to express.vhost?</p>