how to handle error express code example
Example 1: express error handling
app.use(function (err, req, res, next) {
console.error(err.stack)
res.status(500).send('Something broke!')
})
Example 2: put route error express
//don't forget the "/" in the route targeted URL :
app.put("/collection/:id", (req, res)=>{
//route content
})