Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda