I am unable to save the data from react form , but in backend I am able to save only mongoose auto generated ID. This API is not saving email and password in database. When I do console log in server it is showing empty object. request body is giving empty object.
My express api route :
app.post ('/contact', (req, res) => {
const { email,password } = req.body;
const contact = new Contact({
email,
password,
});
console.log(req.body);
contact.save();
res.send(contact);
} )
In front end, in browser developer console I can get the data
question from:
https://stackoverflow.com/questions/65896360/unable-to-send-front-end-form-values-to-backend-api-in-react-expressjs-app 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…