Basically, I have a form that posts to my Node.js form. When I try to console.log the body I get {}
.
I can't understand why even because I have another form that submits on another endpoint in the same server and contains content in the body.
I already have app.use(express.urlencoded({extended: true}));
in my code
In the HTML file, I have:
<form id="form" action="/api/new/post" method="post" enctype="multipart/form-data">
(all the inputs like: <input name="title" id="title" type="text"> )
</form>
In the app.js I have:
const api = express.Router()
app.use(express.urlencoded({extended: true}));
app.use('/api/', api)
api.post('/new/recipe', (req, res)=>{
const {title, description, advices, people} = req.body
console.log(req.body)
res.send('OK')
})