title: How to host multiple node.js apps on the same subdomain with Heroku?
body: <p>We have a base domain of <code>http://api.mysite.com</code>. This should serve as the front door for all our APIs. Let's say we have two different APIs accessed with the following url structure:</p>
  
  <p><code>http://api.mysite.com/launchrockets</code><br>
  <code>http://api.mysite.com/planttrees</code></p>
  
  <p>These are totally different. With regards running this on Heroku it seems we have two options.</p>
  
  <p>1) Put everything inside one application on Heroku. This feels wrong (very wrong) and could lead to a higher chance of changes in one API inadvertently breaking the other.</p>
  
  <p>2) Have 3 different Heroku apps. The first as a proxy (<code>http://mysite-api-proxy.herokuapp.com</code>) that will look at the incoming request and redirect to <code>http://planttrees.herokuapp.com</code> or <code>http://launchrockets.herokuapp.com</code> using a module like <a href="https://github.com/substack/bouncy">bouncy</a> or <a href="https://github.com/nodejitsu/node-http-proxy">http-proxy</a>.</p>
  
  <p>I'm leaning towards option 2 but I am concerned about managing the load on the proxy app. For web frameworks that have a synchronous architecture this approach would be disastrous. Yet with node.js using the <a href="http://nodejs.org/api/cluster.html">cluster module</a> and being asynchronous I think this may scale okay.</p>
  
  <p>I've seen similar questions asked before but most related to synchronous frameworks where option 2 would definitely be a poor choice. This question is specific to node and how it would perform.</p>
  
  <p>Thoughts on best way to architect this?</p>