i am just looking to make an PUT request using Mongoose database. But Its Unable to make any request. I am using postman to pass the data, but no response.
script.js
app.route("/articles/:articleTitle")
.put(function (req, res) {
Article.updateMany(
{ title: req.params.articleTitle },
{ title: req.body.title, content: req.body.content },
{ overwrite: true },
function (err) {
if (!err) {
res.send("Successfully Updated The Data !");
}
}
);
});
here is the code i am using to pass the PUT request in my localhost server but unable to do so.
2
Answers
You don’t send any response in case of an error, causing the request to hang and never return. Change it to e.g.: