I was working with multipart/form-data
to recieve a from with pictures and I keep having a problem trying to redirect to another route, even if I not send any data to that router it never reaches it.
app.listen(8080, () => {
console.log('listening on port 8080');
});
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
const upload = multer({ dest: 'uploads/' })
app.get('/', upload.none(), (req, res) => {
console.log("works here");
console.log(req.body)
/**
* [Object: null prototype] {
email: '[email protected]',
ocupation: 'some ocupation',
}
*/
// res.status(200).send("this would work")
res.redirect('/destiny')
})
app.get("/destiny", upload.none(), (req, res) => {
res.status(200).send("It never reaches here")
})
I think it has something to do with multer
returning the req.body
as [Object: null prototype]
?
Should I use another library? or recieve the picture separately