title: Node.js - req.body empty object
body: <p>I have this code:</p>
  
  <pre class="lang-js prettyprint-override"><code>const bodyParser = require("body-parser");
  const express = require("express");
  const app = express();
  
  app.use(express.json());
  app.use(bodyParser.json());
  
  app.post("/api/foo", (request, response) =&gt; {
    let foo = {
      fooName: request.body.fooName
    };
    console.log(request.body);
    console.log(foo);
    response.send(foo);
  
  });
  </code></pre>
  
  <p>When I'm making a POST request via Postman I can see <code>req.body</code> set as an empty object <code>{}</code> and myVar as <code>undefined</code> in the console logs.</p>
  
  <p>Any ideas what I'm doing wrong?</p>
  
  <p>These are the screenshots when I use the RESTClient in Firefox</p>
  
  <p><a href="https://i.stack.imgur.com/lSH88.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lSH88.png" alt="enter image description here"></a></p>
  
  <p>when I set fooName it gets added to the body section like this and I hit submit</p>
  
  <p><a href="https://i.stack.imgur.com/1YCkI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1YCkI.png" alt="enter image description here"></a></p>
  
  <p>And this is what I get in the terminal</p>
  
  <p><a href="https://i.stack.imgur.com/qUEya.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qUEya.png" alt="enter image description here"></a></p>