expressjs 4 req.body code example
Example 1: express req body
app.post('/login', (req, res) => {
console.log(req.body.email) // "[email protected]"
console.log(req.body.password) // "helloworld"
})
Example 2: expressjs req.body.parameters
app.get('/user/:id', (req, res) => {
console.log(req.params.id) // "1234562134654"
})
or
app.get('/user/:user_id', (req, res) => {
console.log(req.params.user_id) // "1234562134654"
})