Return a JSON response for all 404s.

When an endpoint did not exist, the default expressjs response
was being returned, which is text/html.
This commit is contained in:
D. Berge
2023-11-03 18:52:31 +01:00
parent 71467dddf9
commit fe5ca06060

View File

@@ -360,6 +360,10 @@ app.use(function (err, req, res, next) {
}
});
app.get("*", (req, res, next) => {
res.status(404).send({status: 404, message: "This endpoint does not exist"});
});
app.disable('x-powered-by');
app.enable('trust proxy');
INFO('trust proxy is ' + (app.get('trust proxy')? 'on' : 'off'));