Closed LucasRobs closed 3 years ago
so much important issue to us!
Can I see more of your express server code? Also what module are you trying to use to handle multipart/form-data? Your GitHub issue is pretty bare. There are probably fifteen different modules out there for multipart form data and they all work different 😅
what part of my express server code do you want experimentally?I am using Multer. could you leave a link with one of those solutions that you talked about? thank you for all attention :+1:
Try moving the celebrate
call after the call to upload.single
. My hunch is that multer is parsing the incoming payload for you so if you try to validate it with celebrate before it's been parsed, req.body
will likely be empty.
Should look something like:
routes.post('/product', upload.single('image'), celebrate(/*...same as above*/), ProductController.create);
it worked dear friend, thank you very much for your help :construction_worker:
but particularly I would like to validate first before uploading so the images would not be burned to disk for no reason
node
version - v12.16.3celebrate
version - ^13.0.4joi
version (vianpm ls --depth=0 | grep joi
) - 17.3.0My
joi
schema looks like this:Here is an example value that is not working as expected:
The issue I am having with
celebrate
is:Hello, I'm fighting with a great problem, I can`t to integrate celebrate with multipart/form-data, can you help me?