From 051ff1871a163c62f1c5f5aa5ffb0ac18da49424 Mon Sep 17 00:00:00 2001 From: Kevin J Hoerr Date: Mon, 27 Apr 2020 02:47:38 -0400 Subject: #11 Handle unknown paths with 404 page --- public/static/404.html | 29 +++++++++++++++++++++++++++++ public/static/index.css | 4 ++++ src/routes.ts | 5 +++++ 3 files changed, 38 insertions(+) create mode 100644 public/static/404.html diff --git a/public/static/404.html b/public/static/404.html new file mode 100644 index 0000000..dae7941 --- /dev/null +++ b/public/static/404.html @@ -0,0 +1,29 @@ + + + + + + + + Page not found - AO Coverage + + + + +
+
+ +

404

+
+
+
+
+
+

Oops! The page you are looking for does not exist.

+

Visit the front page

+
+
+
+ + + \ No newline at end of file diff --git a/public/static/index.css b/public/static/index.css index fbf3b63..bef1dbd 100644 --- a/public/static/index.css +++ b/public/static/index.css @@ -39,6 +39,10 @@ div#content p { padding: 0 10px; } +div#smallcontent p { + text-align: center; +} + .code-container-container { margin: 24px; } diff --git a/src/routes.ts b/src/routes.ts index ff3220c..7ebb610 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -217,5 +217,10 @@ export default (metadata: Metadata): Router => { retrieveFile(res, identity, "index.html"); }); + router.use((_, res) => { + res.status(404); + res.sendFile(path.join(__dirname, "..", "public", "static", "404.html")); + }); + return router; }; -- cgit