title: Run node.js & WebAPI on same server for same site with IIS
body: <p>I'm looking to slowly convert a <code>Node.js</code> application over to <code>ASP.NET WebAPI 2.0</code>. I'm currently using <code>IIS</code> and will stick with <code>IIS</code>. So, I would like to host them on the same server but direct some URIs over to the new platform.</p>
  
  <p>How would I do this in the <code>web.config</code>? The current <code>web.config</code> for <code>node.js</code> looks like so:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;system.webServer&gt;
  
      &lt;handlers&gt;
        &lt;!-- indicates that the app.js file is a node.js application
             to be handled by the iisnode module --&gt;
        &lt;add name="iisnode" path="beta/app.js" verb="*" modules="iisnode" /&gt;
      &lt;/handlers&gt;
  
      &lt;rewrite&gt;
        &lt;rules&gt;
          &lt;!-- Don't interfere with requests for node-inspector debugging --&gt;
          &lt;rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"&gt;
            &lt;match url="^beta/app.js\/debug[\/]?" /&gt;
          &lt;/rule&gt;
  
          &lt;!-- First we consider whether the incoming URL matches a physical file in the /public folder --&gt;
  
          &lt;rule name="StaticContent"&gt;
            &lt;action type="Rewrite" url="beta/public{REQUEST_URI}" /&gt;
          &lt;/rule&gt;
  
          &lt;!-- All other URLs are mapped to the Node.js application entry point --&gt;
          &lt;rule name="DynamicContent"&gt;
            &lt;conditions&gt;
              &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" /&gt;
            &lt;/conditions&gt;
            &lt;action type="Rewrite" url="beta/app.js" /&gt;
          &lt;/rule&gt;
  
        &lt;/rules&gt;
      &lt;/rewrite&gt;
      &lt;httpErrors errorMode="Detailed"/&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>The file structure is:</p>
  
  <pre><code>- web.config (the one shown above)
    -&gt; node
        - app.js
        - ...
    -&gt; webapi
        - web.config
        - global.asax
        - ...
  </code></pre>
  
  <p>I was thinking that I should be writing a new rule which lists the URIs to go to the <code>WebAPI</code>. But, I'm not quite sure how to do that. My guess is that I would add a condition for each <code>URI</code> with the <code>input</code> attribute. I was also thinking I should point to the <code>ASP.NET WebAPI</code> project but I am even more clueless how I should go about doing that since <code>Node.js</code> I'm just pointing at the <code>app.js</code> file.</p>