diff options
Diffstat (limited to 'backend/src/index.js')
| -rw-r--r-- | backend/src/index.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/backend/src/index.js b/backend/src/index.js index 128ed60..6b196f3 100644 --- a/backend/src/index.js +++ b/backend/src/index.js @@ -6,6 +6,17 @@ const routes = require('./routes'); const app = express(); +app.use((_, res, next) => { + try { + next(); + } catch (err) { + console.error(err); + res.status(500); + res.json({ + error: 'Internal server error', + }); + } +}); app.use(morgan('dev')); app.use(bodyParser.json()); app.use(cookieParser()); |
