//
app.use((err, req, res, next) => {
console.log(err);
err.statusCode = err.statusCode || 500;
err.status = err.status || 'error';
res.status(err.statusCode).json({
status: err.status,
message: err.message,
}); // {"status":"fail","message":"Page / not found!"}
next();
});
//
No comments:
Post a Comment