I am working on the following request, but when I run it in postman, it returns empty json.
router.get('/:id', (req, res) => {
console.log(req.params.id)
User.findById(req.params.id)
.then((user)=> {
console.log(user.eMail, user.words, user)
res.json(user)})
.catch((err) => {res.status(400).json("Error: "+err)})
})
I am able to get user.eMail, user.words, and user to all console.log. So I believe my json request in postman is working correctly. However, when I try to return the user in JSON format I get blank JSON with a 200 status. I have also tried switching my res.json() with the following
res.json({
eMail: user.eMail,
words: user.words
})})
However, that has also returned me empty JSON in postman