title: React router doesn't work on express server
body: <p>I am new to react, and I am trying to build a chat-app with it. I used react-router to load different components according to the url. In my react project foler (client/src/index.js), the code is as follows:</p>
  
  <pre><code>import {BrowserRouter as Router, Route} from 'react-router-dom';    
  ...
  ReactDOM.render(
    &lt;Router&gt;
      &lt;div&gt;
        &lt;Route exact path='/' component={App} /&gt;
        &lt;Route path='/customer' component={CustomerPage} /&gt;
        &lt;Route path='/support/:support_id' component={SupportPage} /&gt;
      &lt;/div&gt;
    &lt;/Router&gt;,
    document.getElementById('root')
  );
  ...
  </code></pre>
  
  <p>It works find when I start it in the react folder with "npm start". But when I run "npm run build" and serve the static files with express server, it can only serve the App page in the '/' path, while for '/customer' and '/support/:support_id" path, it loads nothing.</p>
  
  <p>In the express server folder, I load the static files in the following way:</p>
  
  <p>server/app.js:</p>
  
  <pre><code>...
  var indexRouter = require('./routes/index');
  app.use('/static', express.static(path.join(__dirname, '../client/build//static')));
  app.use('/', indexRouter);
  ...
  </code></pre>
  
  <p>server/routes/index.js:</p>
  
  <pre><code>...
  router.get('/', function(req, res) {
    res.sendFile('index.html', {root: path.join(__dirname, '../../client/build/')});
  });
  ...
  </code></pre>
  
  <p>Any help will be appreciated!</p>