_includes/api/en/5x/req-body.md
Contains key-value pairs of data submitted in the request body.
By default, it is undefined, and is populated when you use body-parsing middleware such
as express.json() or express.urlencoded().
The following example shows how to use body-parsing middleware to populate req.body.
const express = require('express')
const app = express()
app.use(express.json()) // for parsing application/json
app.use(express.urlencoded({ extended: true })) // for parsing application/x-www-form-urlencoded
app.post('/profile', (req, res, next) => {
console.log(req.body)
res.json(req.body)
})