add 404 error-handling to server This is all that seems necessary according to Express? Admittedly my first time using it. https://expressjs.com/en/starter/faq.html#how-do-i-handle-404-responses

a5dc505e613615a905f7f39e921f9d274b87fb36

Spappz <34202141+Spappz@users.noreply.github.com>

Signed
2 files changed, +21 -0Ignore whitespace
default/public/error/url-not-found.html+15 -0
@@ -0,0 +1,15 @@
1+<!DOCTYPE html>
2+<html>
3+
4+<head>
5+ <title>Not found</title>
6+</head>
7+
8+<body>
9+ <h1>Not found</h1>
10+ <p>
11+ The requested URL was not found on this server.
12+ </p>
13+</body>
14+
15+</html>
server.js+6 -0
@@ -615,6 +615,12 @@ app.use('/api/backends/scale-alt', scaleAltRouter);
615615app.use('/api/speech', speechRouter);
616616app.use('/api/azure', azureRouter);
617617
618+// If all other middlewares fail, send 404 error.
619+const notFoundWebpage = fs.readFileSync('./public/error/url-not-found.html', { encoding: 'utf-8' });
620+app.use((req, res, next) => {
621+ res.status(404).send(notFoundWebpage);
622+});
623+
618624const tavernUrlV6 = new URL(
619625 (cliArguments.ssl ? 'https://' : 'http://') +
620626 (listen ? '[::]' : '[::1]') +