1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-02 16:39:29 +00:00

Added error page and handling

This commit is contained in:
2022-01-24 01:23:38 +00:00
parent 39185c3301
commit 7502c189a1
2 changed files with 24 additions and 0 deletions

12
app.js
View File

@@ -50,6 +50,18 @@ async function main() {
}
}));
// If the request gets to the bottom of the route stack, it doesn't
// have a defined route and therefore a HTTP status code 404 is sent
// and an error page shown
app.use((req, res, next) => {
res.status(404).render('error', {
code: 404,
msg: 'Page Not Found'
});
next();
});
// Start the server
app.listen(serverOptions.port, () => {
console.log(`Server listening on :${serverOptions.port}`);