From 3f948c9c2099b6aae4a4099fd459b5bc498506f5 Mon Sep 17 00:00:00 2001 From: Eric Woodward Date: Sun, 7 Jan 2018 22:06:06 -0500 Subject: [PATCH] ADDED 404 page. UPDATED to v0.1.1. --- app.js | 5 +- package.json | 4 +- public/errors/404.html | 165 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 169 insertions(+), 5 deletions(-) create mode 100755 public/errors/404.html diff --git a/app.js b/app.js index 55e5c7a..708f27d 100644 --- a/app.js +++ b/app.js @@ -51,9 +51,7 @@ app.use('/search/', search); /// catch 404 and forwarding to error handler app.use(function(req, res, next) { - var err = new Error('Not Found'); - err.status = 404; - next(err); + res.status(404).sendFile(path.join(__dirname + '/public/errors', '404.html')); }); /// error handlers @@ -81,4 +79,5 @@ app.use(function(err, req, res, next) { }); + module.exports = app; diff --git a/package.json b/package.json index 888a3f6..15ae615 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mysticbits/codex-mythica", - "version": "0.1.0", + "version": "0.1.1", "private": true, "scripts": { "start": "nodejs ./bin/www" @@ -10,7 +10,7 @@ "cookie-parser": "~1.0.1", "debug": "~0.7.4", "ejs": "^2.5.7", - "express": "~4.0.0", + "express": "~4.16.0", "jade": "~1.3.0", "morgan": "~1.0.0", "static-favicon": "~1.0.0" diff --git a/public/errors/404.html b/public/errors/404.html new file mode 100755 index 0000000..72dcfa7 --- /dev/null +++ b/public/errors/404.html @@ -0,0 +1,165 @@ + + + + + Mythic Wars | Page Not Found + + + +
+

Page Not Found

+

Sorry, but the page you were trying to view does not exist.

+

It looks like this was the result of either:

+ +

You can go back and try again, or just start over at the Mythic Wars home page.

+ + +
+ +