pablocattaneo
1/17/2019 - 10:15 AM

How to validate that an input is not empty in express using express-validator?

How to validate that an input is not empty in express using express-validator? #expressValidator


// body('name').not().isEmpty()

// Example
router.post('/insert', [
  body('name')
  .trim()
  .not().isEmpty()
  .withMessage('This field is required'),
  body('email')
  .isEmail()
  .normalizeEmail()
], adminController.createEmailsToSend)