Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
301 views
in Technique[技术] by (71.8m points)

javascript - There is no response in postman, I'm sending patch request but not receiving response in postman console?

router.patch('/:productId', async (req, res, next) => {

    const id = req.params.productId;
    console.log(req.body)
    const product = await Product.findOneAndUpdate({ _id: id }, { $set: req.body })
})

I can see change into VSC console, but not in the postman.

question from:https://stackoverflow.com/questions/65892463/there-is-no-response-in-postman-im-sending-patch-request-but-not-receiving-res

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to send back a response! you can do that using res.json({product}) if what you need is a json object back!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...