title: POST request to my Node.js server returns 404 in production
body: <p>I am making a <code>POST</code> API request via Axios to my Node server to send a <code>string</code> value into my MongoDB. </p>
  
  <p>The below code works well locally at <code>localhost:8080</code> but as soon as I push my code to Heroku, the requests start to return a <code>404</code>. My node server runs over <code>https</code> and I have configured CORS on its Express framework. </p>
  
  <p>Here is the output I receive when I make the <code>POST</code> request to my node server:</p>
  
  <blockquote>
    <p>POST <a href="https://www.mynodeserverurl.com/api/upload-csv" rel="nofollow noreferrer">https://www.mynodeserverurl.com/api/upload-csv</a> 404 (Not Found)</p>
  </blockquote>
  
  <p>And here is my code for the Node server that processes this API request. </p>
  
  <p><strong>NodeServer/app.js</strong></p>
  
  <pre><code>// Add headers so we can make API requests
  app.use(function (req, res, next) {
    res.setHeader('Access-Control-Allow-Origin', '*');
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
    res.setHeader('Access-Control-Allow-Credentials', true);
    // intercept OPTIONS method
    if ('OPTIONS' == req.method) {
      res.sendStatus(200);
    } else {
      next();
    }
  });
  </code></pre>
  
  <p><strong>NodeServer/routes/api/api.js</strong></p>
  
  <pre><code>router.post('/upload-csv/', (req, res) =&gt; {
    let csv = req.body.csv_string.split('$');
  
    let csv_name = csv[0];
    let csv_string = csv_name+csv[1];
  
    CSVStore.findOne({url: csv_name})
      .then((csv) =&gt; {
        console.log('IN POST REQUEST');
        console.log(csv_string);
  
        return res.status(204).json({msg: 'All good!'});
      })
      .catch((err) =&gt; {
        console.log('There was an error!', err);
  
      });
  });
  </code></pre>
  
  <p>Making a <code>POST</code> request to the above route doesn't even display the <code>console.log()</code> results in the Node server console.</p>
  
  <p>Here is my code for the webapp that makes the <code>POST</code> request to the NodeServer</p>
  
  <pre><code>axios.post(`${utils.fetchURL()}/upload-csv`, {
      csv_string: csv_string
    })
    .then(function(response) {
      console.log('Response', response);
      return {};
    })
    .catch(function(error) {
      console.log('There was an error!', error);
      return {};
    });
  </code></pre>
  
  <p>The URL I am making the <code>POST</code> request on is correct and <code>csv_string</code> is not empty; it has data.</p>
  
  <p>Is there some kind of configuration I need to make in my NodeServer's <code>app.js</code> to allow CORS on <code>https</code>? </p>
  
  <p><strong>UPDATE:</strong> I can confirm that a <code>GET</code> request works. I am able to make a <code>GET</code> request to retrieve a <code>string</code> from my MongoDB. Why does <code>GET</code> work and <code>POST</code> does not?</p>