title: Express status 404 with react-router
body: <p>I have an express server that handles: 1 API route and rendering my initial <code>index.html</code> to include <code>bundle.js</code> holding my React/React-Router/Redux application.</p>
  
  <p>As it stands, it is impossible to 404 on my web page as I have a catch all:</p>
  
  <pre><code>app.use(function (req, res) {
    return res.render('index')
  })
  </code></pre>
  
  <p>In order for <code>react-router</code>'s <code>NoMatch</code> to work I need to send a 404 code.</p>
  
  <p>My routes are as follows:</p>
  
  <p>Express — <code>/api/test/:x/:y</code></p>
  
  <p>React Router — <code>:x/</code>, <code>:x/:y</code></p>
  
  <p>What I am essentially trying to achieve is, if the user ever goes to a URL of: <code>:x/:y/z/and/further</code> then return a 404, <em>unless</em> what they've gone to is <code>/api/test/:x/:y</code></p>
  
  <p>Questions:</p>
  
  <ol>
  <li>How can I match routes, excluding my API routes, preferably in a scalable way, returning appropriate status codes?</li>
  <li>For something so simple, is there significant overhead in setting this up on a subdomain? Would that even alleviate the issue? Would I face issues when the app grows?</li>
  </ol>