I have the following form and submitting it results in an empty req.body
This is my HTML:
<form action="/contact" name="contactUs" id="contactUs" method="POST">
<label for="email">Email Message</label>
<input type="text" name="email" id="email">
<input type="submit" value='Save'>
</form>
And this is (part) of my server.js
:
app.use(bodyParser.json());
app.use("/", expressStaticGzip("dist"));
app.post("/contact", (req, res) => {
console.log('anyone there?')
res.json(req.body);
});
The console.log
works fine. I get an empty object for req.body
though.