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 app = express()
var path = require('path')
var bodyParser = require('body-parser')
app.use(bodyParser.urlencoded({
extended: true
}));
app.get('/', function (req, res) {
res.sendFile('index.html')
})
app.post('/sendmail', function (req, res) {
const formData = req.body.formData
this is what I'm sending from the browser
fetch('/send', {
method: 'POST',
body: new FormData(form)
})
in dev tools I only see the data passed in the Referer, maybe that is my issue
body-parser
doesn't handle multipart request bodies, try something likemulter
. – Limber