Stop attempt at sending a spurious 404.

This was resulting in a bunch of "headers already sent" messages.
This commit is contained in:
D. Berge
2024-05-09 14:18:56 +02:00
parent d154e75797
commit e398f2d3cd

View File

@@ -365,7 +365,9 @@ app.use(function (err, req, res, next) {
});
app.get("*", (req, res, next) => {
res.status(404).send({status: 404, message: "This endpoint does not exist"});
if (!res.headersSent) {
res.status(404).send({status: 404, message: "This endpoint does not exist"});
}
});
app.disable('x-powered-by');