I am currently facing an issue where I am using Postman to enter a post into a MongoDB server, but the post returns empty. Even after checking my server, nothing has been entered and there are no errors displayed.
Here is the route file:
router.post('/', async (req,res) => {
const post = new customer({
fullName: req.body.fullName,
id: req.body.id
});
try{
const savedCust = await customer.save();
res.json(savedCust);
} catch (err) {
res.json({message: err});
}
});
module.exports = router;
This is what I submitted on Postman:
{
"fullName" : "Tim Scott",
"id": 87438
}
However, the response that I received is as follows:
{
"message": {}
}