title: Express: server unable to handle refresh when using URL param
body: <p>When using URL param, e.g. <code>books/1</code>, for some reason the express app is unable to find and serve <code>Index.js</code>. </p>
  
  <p>I am using absolute path, but even still my express app is unable to find <code>Index.js</code> when refreshed at a url using params. </p>
  
  <p><a href="https://i.stack.imgur.com/re4gt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/re4gt.png" alt="unable to find Index.js"></a></p>
  
  <p>As you can see in the screenshot instead of serving <code>Index.js</code> it is unable to find it and serves html file instead as the <code>Index.js</code>. </p>
  
  <p>I am doing the <a href="https://stackoverflow.com/questions/27928372/react-router-urls-dont-work-when-refreshing-or-writting-manually">catch-all solution</a>, which works great until refreshed at a url param:</p>
  
  <pre><code>app.use(express.static(path.resolve(__dirname,  '..', 'build')));
  app.get('/*', (req, res) =&gt; {
   res.sendFile(path.join(__dirname, '..', 'build', 'index.html'));
  });
  </code></pre>
  
  <p>I've even tried to set up a specific route for <code>/Index.js</code>, but no luck. </p>
  
  <pre><code>app.use(express.static(path.resolve(__dirname,  '..', 'build')));
  app.get('/Index.js', (req, res) =&gt; {
   res.sendFile(path.join(__dirname, '..', 'build', 'Index.js'))
  });
  app.get('/*', (req, res) =&gt; {
   res.sendFile(path.join(__dirname, '..', 'build', 'index.html'));
  });
  </code></pre>
  
  <p>I've also tried using <a href="https://expressjs.com/en/resources/middleware/serve-static.html" rel="nofollow noreferrer">serve-static</a> instead of <code>express.static</code> but didn't help. </p>
  
  <p>I've duplicated the issue in this <a href="https://github.com/schinns/refresh-issue-duplicate" rel="nofollow noreferrer">repo</a> if anyone is interested in taking a look.</p>
  
  <p>The front-end of this project is in <a href="https://reasonml.github.io/reason-react/" rel="nofollow noreferrer">reason-react</a>.</p>