Basically, I am using Thunder Client to send the requests and I am using the post request. The failure that I am facing is that whenever I send the request and also send the body contents and have already used content-type application/json
in the header and when at the request portion I try to get req.body
it returns undefined
. I don't know why this error is occurring. Could someone please help?
const express = require('express');
const router = express.Router();
const { body, validationResult } = require('express-validator');
const Admin = require('../Models/Admin');
//Route 1 : Create an ADMIN Account
router.post('/createadmin', async (req, res)=>{
console.log(req.body)
res.json(req.body)
})
module.exports = router