Created
January 17, 2019 10:15
-
-
Save pablocattaneo/aa18a37cfcaed20b00da615640a837b0 to your computer and use it in GitHub Desktop.
How to validate that an input is not empty in express using express-validator? #expressValidator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// body('name').not().isEmpty() | |
// Example | |
router.post('/insert', [ | |
body('name') | |
.trim() | |
.not().isEmpty() | |
.withMessage('This field is required'), | |
body('email') | |
.isEmail() | |
.normalizeEmail() | |
], adminController.createEmailsToSend) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment