feat: add 404 handling
All checks were successful
Update changelog / changelog (push) Successful in 25s

This commit is contained in:
2025-12-09 12:49:55 +01:00
parent 58460d988d
commit bade2f9b86

View File

@@ -25,5 +25,18 @@ app.use(router);
if (process.env.DEBUG === "true") {
app.use('/swagger', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
}
// Handle 404s
// https://stackoverflow.com/a/9802006
app.use(function(req, res) {
res.status(404);
if (req.accepts('json')) {
res.json({ status: 'error', error: 'Not found' });
return;
}
res.type('txt').send('Not found');
});
app.listen(6567, () => console.log('(HTTP Server) Listening on port 6567.'));