title: parse form data in nodejs service
body: <pre><code>var express = require('express');
  var bodyParser = require('body-parser');
  var app = express();
  
  app.use(bodyParser.json());
  //app.use(express.urlencoded());
  app.use(bodyParser.urlencoded({// to support URL-encoded bodies
      extended: true`enter code here`
  }));
  
  app.post('/register', function (req, res) {
      console.log("inside log");
      console.log(req.body);
      var username = req.body.username;
      console.log(username);
  });
  </code></pre>
  
  <p>As I have used urlencoded() whenever I post data in form data, I do not get data in req.body. i have attached image of postman</p>
  
  <p>in case I send data in x-www-urlencoded then I get data</p>
  
  <p><a href="https://i.stack.imgur.com/awXQq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/awXQq.png" alt="enter image description here"></a></p>
  
  <p>Please give me a solution to parse the data. I want to pass it in form data because I will be uploading an image too. So for image form data is must</p>