title: Express.js POST req.body empty
body: <p>So I have the following code in my server.js file that I'm running with node.js. I'm using express to handle HTTP requests.</p>
  
  <pre><code>app.post('/api/destinations', function (req, res) {
    var new_destination = req.body;
    console.log(req.body);
    console.log(req.headers);
    db.Destination.create(new_destination, function(err, destination){
      if (err){
        res.send("Error: "+err);
      }
      res.json(destination);
    });
  });
  </code></pre>
  
  <p>I'm running the following in Terminal:</p>
  
  <pre><code>curl -XPOST -H "Content-Type: application/json" -d '{"location": "New York","haveBeen": true,"rating": 4}' http://localhost:3000/api/destinations
  </code></pre>
  
  <p>After running that server.js prints out the following.</p>
  
  <pre><code>{}
  { host: 'localhost:3000',
    'user-agent': 'curl/7.43.0',
    accept: '*/*',
    'content-type': 'application/json',
    'content-length': '53' }
  </code></pre>
  
  <p>So req.body is <code>{}</code>. I read other Stack Overflow posts about similar issues where content-type was not correct because of body-parser. But that isn't the issue because content-type is application/json.</p>
  
  <p>Any ideas how to get the actual body of the request?</p>
  
  <p>Thanks in advance.</p>