I'm doing a MERN test project.
But at the time of testing a post method is not returning the value sent.
Any idea what the problem might be?
I'm doing a MERN test project.
But at the time of testing a post method is not returning the value sent.
Any idea what the problem might be?
use in app.js
app.use(express.json());
OR
If you want to simple boilerplate and Expressjs project structure then use Express application generator https://expressjs.com/en/starter/generator.html
You just need to install body-parser
npm install body-parser --save
Check this link What does body-parser do with express?
With the help of the comments detect the origin of the problem. A typing error ♂️ : when calling server.unsubscribe(express.json())
instead of using server.use(express.json())
;
Correcting this line fixed the problem. ✌