Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
Express-Validator issue

I am facing an issue with express-validator, when I use its body validation like body('email').isEmail() or any type of validation then after that VS Code don't show me any suggestions.

    router.post('/register', [
    body('email').isEmail(),
    body('password', 'Password must be 7 characters long').isLength({ min: 7 })
], (req, res) => {
    const errors = validationResult(req);
    if (!errors.isEmpty()) {
        return res.status(400).json({ errors: errors.array() });
    }

});

when I use [] to create an array of body validation then vs code stop giving me suggestion and if I remove those [] then I can't use suggestion on validations. When I use [] : When I type res.s then I should get suggestion/ emmet like send, status etc. but I don't get any. When I don't use [] : When I type body('email'). I should get suggestions / emmet like isEmail(), isLength() etc. but I don't receive any emmet.

My package.json file:

"dependencies": {
    "bcryptjs": "^2.4.3",
    "dotenv": "^10.0.0",
    "express": "^4.17.1",
    "express-validator": "^6.12.2",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^6.0.9"
  }

Anyone have any idea. Thanks for your help.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

check the below link. In the example show in this link they are not using [] brackets

https://express-validator.github.io/docs/

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!