title: Express POST request.body undefined
body: <p>I am trying to make POST work with Express (4.13.3 version). when I print request.body.user, it says 'undefined'. I am using Chrome Poster to post my JSON request. Here is how my request looks</p>
  
  <pre><code>{
  "user":"testUser",
   "password":"test pwd"
  }
  </code></pre>
  
  <p>the URL I use: <a href="http://localhost:4000/first" rel="nofollow">http://localhost:4000/first</a></p>
  
  <p>and my server.js file.</p>
  
  <pre><code>var express = require('express');
  var bodyParser = require('body-parser');
  var app = express();
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: true }));
  
  app.post('/first', function (request, response) {
      console.log('FIRST POST hello world');
      console.log('req.body:' + request);
     var user_name=request.body.user;
    var password=request.body.password;
    console.log("User name = "+user_name+", password is "+password);
    response.end("yes");
  }); 
  
  var server = app.listen(4000, function() {
      var host = server.address().address;
      var port = server.address().port;
  
    console.log('Example app listening at http://%s:%s', host, port);
  });
  </code></pre>
  
  <p>when I post the request, here is what I see on my Node console.</p>
  
  <pre><code>Example app listening at http://:::4000
  FIRST POST hello world
  req.body:[object Object]
  User name = undefined, password is undefined
  </code></pre>
  
  <p>Why I am not able to get my 'user' and 'password' values here from my request? I am getting 'undefined' for both of these variables.</p>