title: Express Validator Error: expressValidator is not a function
body: <p>I'm trying to install and use <a href="https://express-validator.github.io/docs/" rel="noreferrer">express-validator</a> package. I've installed the package version (6.0.0) and then in my server.js file the code is:</p>
  
  <pre><code>const bodyParser = require('body-parser')
  const expressValidator = require('express-validator')
  const express = require('express')
  const nunjucks = require('nunjucks')
  const sessionInMemory = require('express-session')
  const cookieParser = require('cookie-parser')
  </code></pre>
  
  <p>Then a few lines down I've put in the following:</p>
  
  <pre><code>const app = express()
  const documentationApp = express()
  app.use(expressValidator())
  </code></pre>
  
  <p>When the server reloads the changes (using nodemon) the app crashes and says:</p>
  
  <p><strong>TypeError: expressValidator is not a function</strong></p>
  
  <p>There are other bits of code in my server.js file but I've stripped out most of it that isn't relevant I think.</p>
  
  <p><strong>Console log for expressValidator:</strong></p>
  
  <pre><code>{ oneOf: [Function: oneOf],
    buildSanitizeFunction: [Function: buildSanitizeFunction],
    sanitize: [Function],
    sanitizeBody: [Function],
    sanitizeCookie: [Function],
    sanitizeParam: [Function],
    sanitizeQuery: [Function],
    buildCheckFunction: [Function: buildCheckFunction],
    check: [Function],
    body: [Function],
    cookie: [Function],
    header: [Function],
    param: [Function],
    query: [Function],
    checkSchema: [Function: checkSchema],
    matchedData: [Function: matchedData],
    validationResult: { [Function] withDefaults: [Function: withDefaults] },
    Result: [Function: Result] }
  </code></pre>
  
  <p><strong>Code for routes.js file:</strong></p>
  
  <pre><code>router.get('/email-adress', function (req, res) {
    res.render('email-adress', { success: req.session.success, errors: req.session.errors })
    req.session.errors = null
  })
  
  router.post('/finished', function (req, res) {
    let email = req.body.email
  
    req.checkBody('email', 'Email required').isEmail()
  
    var errors = req.validationErrors()
    if (errors) {
      req.session.errors = errors
      req.session.success = false
      res.redirect('/email-adress')
    } else {
      req.session.success = true
      res.redirect('/finished')
    }
  })
  </code></pre>