Add an error handling middleware to catch and respond to errors:
app.use((err, req, res, next) => {
console.error(err.stack);
res.status(500).send('Something broke!');
});
Add an error handling middleware to catch and respond to errors:
app.use((err, req, res, next) => {
console.error(err.stack);
res.status(500).send('Something broke!');
});
Leave a Reply