title: express-validator does not work without (deprecated ?) body-parser
body: <p>I have seen a number of posts which seem to say body-parser is deprecated at least for using with express-validator. I also can see no mention of body-parser on the express-validation documentation Getting Started page. However, when I try and follow that Getting Started tutorial I find I can not get it to work without body-parser. I could not follow their tutorial precisely because I did not understand some of it but I do not think the simplifications I have made would be relevant to this issue.</p>
  
  <p>My question is: is it OK to use body-parser in the way I am doing it?</p>
  
  <p>Below is what I did (I have node version 10.10.0):</p>
  
  <pre><code>mkdir express-validator
  cd express-validator
  npm install --save express
  npm install --save express-validator
  </code></pre>
  
  <p>app.js file:</p>
  
  <pre><code>const express = require('express')
  const app = express()
  
  app.use(express.json())
  
  const { check, validationResult } = require('express-validator/check')
  
  const bodyParser = require('body-parser')
  
  app.use(bodyParser.urlencoded({ extended: false }))
  
  app.post('/user', [
    // username must be an email
    check('username').isEmail(),
    // password must be at least 5 chars long
    check('password').isLength({ min: 5})
  ], (req, res) =&gt; {
    // Finds the validation errors in this request and wraps them in an object with handy functions
    const errors = validationResult(req)
    if (!errors.isEmpty()) {
      res.send(errors.array())
      return
    }
    res.send('ok')
  })
  
  app.listen(5000, () =&gt; console.log(`listening on port $5000`))
  </code></pre>
  
  <p>I start the server using <code>node app.js</code></p>
  
  <p>Then I use curl:</p>
  
  <pre><code>curl -d username=fred@gmail.com -d password=12345 localhost:5000/user
  </code></pre>
  
  <p>That works ie I get OK sent back. If I remove the @ symbol from the email address I get this:</p>
  
  <pre><code>[{"location":"body","param":"username","value":"fredgmail.com","msg":"Invalid value"}]
  </code></pre>
  
  <p>If I comment out the line: <code>app.use(bodyParer.url etc etc</code> I get the error.array() sent back with both the curl commands above.</p>
  
  <p>Is it OK to use body-parser as I have done? If not what should I do to get this to work?</p>