+ 2
First you need to initialise bodyParser like that👇 const bodyParser = require('body-parser') Then configure it like that 👇 const jsonParser = bodyParser.json() var urlencodedParser = bodyParser.urlencoded({ extended: true }) So in your url post 👇 app.post("/login", urlencodedParser, (request, response)=>{ const email = req.body.email //Some code } )
17th Oct 2022, 3:45 PM
FĂ©lix Zamdamela
FĂ©lix  Zamdamela - avatar
+ 1
Express now has its own support app.use(express.json()) app.use(express.urlencoded({ extended: true })) And you can access it everywhere directly from the request object. Like so: req.body
17th Oct 2022, 9:52 PM
Toni Isotalo
Toni Isotalo - avatar