title: Express post request timing out in chrome
body: <p>I am new to API development and am trying to create a post request and send data to an API but it keeps timing out in chrome. The error I am getting is net::ERR_EMPTY_RESPONSE.
  This is my js where I am trying to send the info. It is called in another method called addToCart() where I am passing in the cart as a parameter.</p>
  
  <pre><code>function sendToAPI(cart) {
    var req = new XMLHttpRequest();
    req.open('POST', '/add');
    req.setRequestHeader('Content-Type', 'application/json');
    req.send(JSON.stringify({cart : cart}));
    req.addEventListener('load', () =&gt; {
      console.log(req.resonseText);
    })
    req.addEventListener('error', () =&gt; {
      console.log('There was an error');
      console.log(error);
    });
  
  }
  </code></pre>
  
  <p>This is where I am creating the API:</p>
  
  <pre><code>const express = require("express");
  const bodyParser = require("body-parser");
  
  const api = express();
  
  api.use(express.static(__dirname + '/public'));
  api.use(bodyParser);
  
  api.listen(3000, function() {
    console.log("Server is running on port 3000");
  });
  
  
  api.post('/add', function(req, res) {
    console.log(req.body);
    res.send("It works");
  });
  </code></pre>