i would like to remove an object of specified id: I tried by this:
app.delete("/:id", (req, res) => {
const id = req.params.id;
try {
const filtered = games.filter(function (el) {
return el.id !== id;
});
res.send({ rest: filtered });
} catch (error) {
res.send({ error: error.message });
}
});
This although, does not remove the object in games array of objects, but returns the filtered array. Does anyone have an idea on that?