title: How to get the correct HTTP POST status code between Node.js express and jQuery client
body: <p>In a Node.js app running Express, I have a route setup to take POST requests and create database objects.</p>
  
  <pre><code>app.post('/', function(req, res) {
      // create object in DB
      res.send('');
      res.status(201).end();
  });
  </code></pre>
  
  <p>I understand a <a href="https://httpstatuses.com/201" rel="nofollow">201 status code</a> indicates successful creation of the object. I wish to receive a 201 status in my jQuery POST on the client side:</p>
  
  <pre><code>$.post('/', sendData).done(function(receiveData, status, xhr) {
      alert(xhr.status); // returns 200 status
  });
  </code></pre>
  
  <p>However, I am receiving a 200 status, not the 201 I am trying to send.</p>
  
  <p><strong>What can I change to receive at the client the 201 status code I am trying to send from the server?</strong></p>