-1
Good morning, I am validating the data on a backend route and need a null or empty accepted field, so I used the following code:
// Rota para postar arte individual
router.post('/postarArte',
verificarToken,
// upload
multer(multerConfig).single('file'),
// validação de dados
celebrate({
[Segments.BODY]: Joi.object().keys({
titulo: Joi.string().required().max(30),
desc: Joi.string().allow(null).max(500),
tipo: Joi.string().required()
})
}),
// inserção no banco de dados
postarArte
);
I am sending the following Multipart form for testing:
arquivo: [File]
desc: "" // Preciso que esse campo aceite vazio
tipo: "ILLUSTRATION"
titulo: "asdasd"
and always returns me "status 400 (Bad Request)", there is some other way to do this?