title: Retrieve JSON POST Parameters in express node
body: <p>this is the first time I am using node js. I am sending post request through Postman. The problem is I am unable to get these params. It says undefined or empty</p>
  
  <p><a href="https://i.stack.imgur.com/WKVqV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WKVqV.png" alt="enter image description here"></a></p>
  
  <p>This is what I have tried so far</p>
  
  <pre><code>var express = require("express");
  var app = express();
  
  
  var bodyParser = require('body-parser')
  app.use( bodyParser.json() );       // to support JSON-encoded bodies
  app.use(bodyParser.urlencoded({     // to support URL-encoded bodies
      extended: true
  }));
  
  
  // support encoded bodies
  app.listen(3000, () =&gt; {
      console.log("Server running on port 3000");
  });
  
  
  
  
  
  
  app.post('/login',function(req,res){
  
      console.log('request =' + JSON.stringify(req.body))
      console.log(req.body);
  
      var user_name=req.body.user;
      var password=req.body.password;
      res.send(req.body);
  
      console.log("User name = "+user_name+", password is "+password);
      res.end("yes");
  });
  </code></pre>
  
  <p>express version is 4.16.4</p>
  
  <p>This is what appears on the console</p>
  
  <p><a href="https://i.stack.imgur.com/dPwRg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dPwRg.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/ry98W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ry98W.png" alt="enter image description here"></a></p>