From bee021d7fdcda6874e8b9bb5f7c2670243af184c Mon Sep 17 00:00:00 2001 From: Thomas Wade Date: Wed, 17 Oct 2018 10:47:21 +1030 Subject: [PATCH] Properly root 404 --- server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 2f7d9a5..04be1f4 100644 --- a/server.js +++ b/server.js @@ -6,9 +6,9 @@ var app = express(); app.use(express.static("./")); // Serve static files from root app.use(express.json()); // Parse JSON in requests -app.use((req, res, next) => // Finally send a 404 page +app.use("/", (req, res, next) => // Finally send a 404 page { - res.status(404).sendFile("/home/tom/Repos/WebDev-Assignment-2/404.html"); + res.status(404).sendFile("404.html", {"root": "./"}); }); // Root route, respond with with index.html