Make sure your middleware is ordered properly, and if you're using Postman
setting the "Content-Type" header to "application/json" might help.
If testing the API using POSTMAN, ensure that 'Content-Length' header is active and set to <calculated when request is sent>.
// Envirnoment variable
require('dotenv').config()
const express = require('express')
const port = process.env.PORT
const app = express()
const cookieParser = require('cookie-parser')
app.use(express.json())
app.use(cookieParser())
router.post('/profile', (req, res) => {
console.log(req.body);
});
app.listen(port, () => console.log(`Server listening on ${port}`))