title: What is the difference between node's bodyParser and express's urlencoded middleware?
body: <p>After reading about both i still can't wrap my head about it,
  could be language differences bu please help clarify.</p>
  
  <p><code>express.urlencoded()</code></p>
  
  <blockquote>
    <p>Returns middleware that only parses urlencoded bodies and only looks at requests where the Content-Type header matches the type option. This parser accepts only UTF-8 encoding of the body and supports automatic inflation of gzip and deflate encodings.</p>
  </blockquote>
  
  <p>And</p>
  
  <p>and <code>body-parser</code> middleware </p>
  
  <blockquote>
    <p>Parse incoming request bodies in a middleware before your handlers, available under the req.body property.</p>
  </blockquote>
  
  <p>i understand that <code>express.urlencoded</code> is based on Nodejs <code>body-parser</code>.
  and both pages,</p>
  
  <p><a href="https://expressjs.com/en/api.html#express.urlencoded" rel="noreferrer">https://expressjs.com/en/api.html#express.urlencoded</a></p>
  
  <p>and</p>
  
  <p><a href="https://expressjs.com/en/resources/middleware/body-parser.html" rel="noreferrer">https://expressjs.com/en/resources/middleware/body-parser.html</a> </p>
  
  <p>even say the same warning note: </p>
  
  <blockquote>
    <p>As req.body’s shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, req.body.foo.toString() may fail in multiple ways, for example foo may not be there or may not be a string, and toString may not be a function and instead a string or other user-input.</p>
  </blockquote>
  
  <p>but eventually both give me a <code>req.body</code> with params sent in requests body object. so why should i use body-parser (which i have to install separatly) instead of always using <code>express.urlencoded()</code></p>
  
  <p>I know this isn't a code problem but i thank in advance for anyone who can list up to the main differences.</p>