From 0bacce5fcd21b961efda90f51160e9c6d36975d8 Mon Sep 17 00:00:00 2001 From: hippoz Date: Mon, 5 Oct 2020 00:37:01 +0300 Subject: [PATCH] add error handling --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 53ce62b..6acc8e5 100644 --- a/index.js +++ b/index.js @@ -147,6 +147,11 @@ app.post('/api/upload', [ cors(corsOptions) ], (req, res) => { }); }); +app.use(function (err, req, res, next) { + console.error(err.stack); + res.status(500).send('Internal Server Error: Something went wrong'); +}); + app.listen(config.server.port, () => { console.log(`Started server on port ${config.server.port}`); }); \ No newline at end of file