JOI
const registerSchema = Joi.object({
name: Joi.string().min(3).max(30).required(),
email: Joi.string().email().required(),
password: Joi.string().min(5).required(),
repeat_password: Joi.ref('password')
})
let { error } = registerSchema.validate(req.body)
if (error) {
return next(error)
}
Rasel Hossain