title: node.js, express, how to get data from body form-data in post request
body: <p>I have a simple node.js app. I want to get post body from user.</p>
  <p><strong>app.js</strong></p>
  <pre><code>var express = require('express');
  var app = express();
  
  app.use(express.json());
  
  app.post('/api/user', function (req, res) {
      console.log(req.body);
      console.log(req.body.username);
  });
  
  module.exports = app;
  </code></pre>
  <p><strong>server.js</strong></p>
  <pre><code>var app = require('./app.js');
  
  var server = app.listen(3000, function () {
  
      var port = server.address().port;
  
      console.log('Web App Hosted at http://localhost:%s',port);
  
  });
  </code></pre>
  <p>When i launch it with <code>node server.js</code>, its fine. When i check it with postman,
  <a href="https://i.stack.imgur.com/l7e5v.png" rel="noreferrer"><img src="https://i.stack.imgur.com/l7e5v.png" alt="enter image description here" /></a></p>
  <p>in console, it returns</p>
  <pre><code>Web App Hosted at http://localhost:3000
  {}
  undefined
  </code></pre>
  <p>I have the newest express.</p>
  <p>And i have try other thing like add <code>body-parser</code>, add header to <code>content-type</code>, add <code>express.urlencoded()</code>, but none work. i need to get data from <code>form-data</code> like postman on picture above. How i can get it?</p>