Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 6x 6x 6x 6x 6x 6x 6x | const { body, validationResult } = require('express-validator'); const { validate } = require('../validate'); const username = body('username') .trim() .notEmpty().withMessage('Username is required') .isLength({ min: 3 }).withMessage('Username must be at least 3 characters'); const password = body('password') .notEmpty().withMessage('Password is required') .isLength({ min: 8 }).withMessage('Password must be at least 8 characters'); const email = body('email') .isEmail().withMessage('Invalid email address') .normalizeEmail(); const fullName = body('full_name') .trim() .notEmpty().withMessage('Full name is required'); module.exports = { validateLogin: [username, password, validate], validateRegister: [username, password, email, fullName, validate] }; |