0

i am having trouble making a patch request i am logging the req.body but it is turn to an empty object.Also if my code is wrong please help me create a route. here is my code:

app.patch('/update/:_id', async (req, res) => {
console.log(req.body) //-- sends {}


    try {
        await LogInCollection.findByIdAndUpdate(req.params._id,{ $set:{name : req.body.name}}, {new : true});
        res.status(200).send('it worked')Ï
    } catch (error) {
        res.status(404).send(req.body)
    }
})
Eddie
  • 45
  • 2
  • 10
  • Does this answer your question? [req.body empty on posts](https://stackoverflow.com/questions/24543847/req-body-empty-on-posts) – robere2 Jan 15 '23 at 02:54

0 Answers0