I tried sending some form data to my node server but req.body
has none of my form fields the node side
var express = require(\'express\')
var a
body-parser
doesn't handle multipart bodies, which is what FormData
is submitted as.
Instead, use a module like multer.
For example, to retrieve the (regular) fields of a request:
const multer = require('multer');
const upload = multer();
app.post('/send', upload.none(), (req, res) => {
const formData = req.body;
console.log('form data', formData);
res.sendStatus(200);
});