title: The JSON data in request body is not getting parsed using body-parser
body: <p>When I send a POST request using postman to localhost:8080/api/newUser with request body:</p>
  
  <pre><code>{name: "Harry Potter"}
  </code></pre>
  
  <p>At server end console.log(req.body) prints:</p>
  
  <pre><code>{ '{name: "Harry Potter"}': '' }
  </code></pre>
  
  <p>server.js</p>
  
  <pre><code>var express = require('express'); 
  var app = express();
  var router = express.Router();
  var bodyParser = require('body-parser');
  
  app.use('/', express.static(__dirname));
  
  router.use(function(req, res, next) {
      next();
  });
  
  router
      .route('/newUser')
      .post(function(req, res) {
          console.log(req.body);
      });
  
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(bodyParser.json()); // support json encoded bodies
  app.use('/api', router);
  
  app.listen(8080);
  </code></pre>
  
  <p>What am I doing wrong?</p>