How to send html form to route node? Crud!

0

Hello, I have to send the information of an html form via POST to a crud on node and mongodb! I can not do it! follows the code below:

pastebin code: link

    
asked by anonymous 16.10.2018 / 14:29

1 answer

1

body-parser does not provide support for Content-Type multipart/form-data . For this you can use middleware like multer . To do this, just adapt your routes that will receive the contents of form as follows:

// Importações
const multer = require('multer');
const upload = multer();
...
.post(upload.any(), function(req,res) {
...

So the content of the fields will be present in req.body .

    
17.10.2018 / 14:15