title: Node server response is HTML after adding catch-all to allow react-router to work
body: <p>I have been developing a node backend, react front end web app for a couple months. It has working just fine when I started the server via nodemon and the front end with npm start. But now that I am getting ready to host an alpha version and ran 'npm run build' I've been running into issues. </p>
  
  <p>It seems to be stemming from the interaction of accessing the app from the server's port and react-router. I added a catch-all endpoint app.get('/*'...) to my server to allow the react-router to work. So now when the front requests data, the response is HTML not the array I want.</p>
  
  <p>I feel like there is a simple solution to this, but I just don't see it yet. I looked into using HashRouter instead of BrowserRouter, but unfortunately I can't use that because I am using MSAL Active Directory for login. </p>
  
  <p>server/index.js</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const express = require('express');
  const bodyParser = require('body-parser');
  const cors = require('cors')
  require('dotenv').config();
  const massive = require('massive');
  const session = require("express-session");
  const morgan = require('morgan');
  const path = require('path');
  const ctrl = require(`./controllers/controller.js`);
  
  //Middleware
  const app = express();
  app.use(bodyParser.json());
  app.use(cors());
  app.use(express.static(__dirname + './../build'));
  app.use(morgan('dev'));
  
  //Connection to Azure DB
  massive(process.env.CONNECTION_STRING)
  .then(db =&gt; {
      console.log('Connected to Azure PostgreSQL Database')
      app.set('db', db)
  }).catch(err=&gt;console.log(err))
  
  app.use(session({
      secret: process.env.SESSION_SECRET, 
      cookie: { maxAge: 60000 },
      resave: false,
      saveUninitialized: true
     })); 
   
  //Endpoints
  app.get('/*', function(req, res) {
      res.sendFile(path.join(__dirname, './../build/index.html'), function(err) {
        if (err) {
          res.status(500).send(err)
        }
      })
    })
  
  app.get('/getallemployees/', ctrl.getAllEmployees)
  
  app.listen(8080, () =&gt; console.log(`Listening on ${8080}`));</code></pre>
  </div>
  </div>
  </p>