title: express-validator: how to check queries
body: <p>With <code>express-validator</code> how can we check the query for a request? </p>
  
  <p>In the documentation there is an example to check body:</p>
  
  <pre><code>const { check, validationResult } = require('express-validator/check');
  
  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()) {
      return res.status(422).json({ errors: errors.array() });
    }
  
    User.create({
      username: req.body.username,
      password: req.body.password
    }).then(user =&gt; res.json(user));
  });
  </code></pre>
  
  <p>How can I set it to check only the query for <code>GET</code> methods?</p>
  
  <p><code>GET /user?username=name</code>
  I just want to check <code>username</code> in the query here.</p>