Thursday, 30 November 2017

Simple Form Submission to Backend. Why is req.body empty. Noob Error 🤕

Been tearing my hair out on this. Very grateful if anyone could explain where I'm going wrong.This is my HTML:
And this is my Server.jsapp.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. Thanks for any help.

Submitted November 30, 2017 at 01:46PM by harrydry

No comments:

Post a Comment