// String required
body('name')
.trim()
.not().isEmpty()
.withMessage('This field is required')
.isString()
.withMessage('This field must be an string')
// Email required
body('email')
.trim()
.isEmail()
.withMessage('Must be a valid email address')
.normalizeEmail()
// Example:
const express = require('express')
const adminController = require('../controllers/admin')
const { body } = require('express-validator/check')
const router = express.Router()
router.post('/insert', [
body('name')
.trim()
.not().isEmpty()
.withMessage('This field is required')
.isString()
.withMessage('This field must be an string'),
body('lastName')
.trim()
.not().isEmpty()
.withMessage('This field is required')
.isString()
.withMessage('This field must be an string'),
body('email')
.trim()
.isEmail()
.withMessage('Must be a valid email address')
.normalizeEmail()
], adminController.createEmailsToSend)