Node JS API : #08 - Input Validation

Publicado el: 24 septiembre 2022
en el canal de: Youssef Abbas
6,844
231

In this part we validate the data that comes from the client with Joi package.

If you want to have custom message with Joi you should use messages() method.
Example:
------------------------------------------------------------------------------------------------------------------------
const schema = Joi.object({
username: Joi.string().trim().min(3).max(100).required().messages({
'any.required': 'الاسم مطلوب',
'string.base': 'الاسم لازم يكون من نوع نص',
'string.empty': 'رجاء ادخال الاسم',
'string.min': 'لا يجوز الاسم يكون اقل من ثلاثة حروف',
'string.max': 'لا يجوز الاسم يكون اكثر من مئه حروف',
}),
});
--------------------------------------------------------------------------------------------------------------------------


En esta página del sitio puede ver el video en línea Node JS API : #08 - Input Validation de Duración hora minuto segunda en buena calidad , que subió el usuario Youssef Abbas 24 septiembre 2022, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 6,844 veces y le gustó 231 a los espectadores. Disfruta viendo!