title: How do I make a post request from a react front-end to a node back-end? Getting 404
body: <p>I'm trying to make a simple website where users can post things to learn the MEAN stack. When I'm handling the POST request, which will be handled and inputed to the MongoDB server through the back-end. React is on port 3000, and the server is on 5000. How do I make the request go from 3000 to 5000? My request works through Postman but not using axios. I added the proxy to the client-side package.json.</p>
  
  <p>I've tried changing the proxy, adding CORS, changing to every single possible route. Nothing works.</p>
  
  <p>Back-end:</p>
  
  <pre><code>router.post('/api/req',(req,res)=&gt;{
      const newPost = new Post({
          title: req.body.title,
          description: req.body.description
      })
      newPost.save().then(()=&gt;{
          console.log('Item added to database!')
      });
  
  })
  </code></pre>
  
  <p>Front-end:</p>
  
  <pre><code>axios({
        method: 'post',
        url: '/api/req',
        data: {
          title: this.state.title
        },
        validateStatus: (status) =&gt; {
          return true; 
        },
      }).catch(error =&gt; {
          console.log(error);
      }).then(response =&gt; {
          console.log(response);
      });
  </code></pre>
  
  <p>"proxy": "<a href="http://localhost:5000/" rel="nofollow noreferrer">http://localhost:5000/</a>"  - package.json</p>
  
  <p>I'm expecting the POST request to go through, and for the title to be inputed into the database. Instead, I get the error: Failed to load resource: the server responded with a status of 404 (Not Found)</p>
  
  <p>The error is coming from localhost:3000/api/req, and it should be proxying port 5000. Also, the actual route is routes/api/req.js.</p>