aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2020-04-27 02:47:38 -0400
committerKevin J Hoerr <kjhoerr@protonmail.com>2020-04-27 02:47:38 -0400
commit051ff1871a163c62f1c5f5aa5ffb0ac18da49424 (patch)
tree7e3f1939922f587bbc37178683d538733e12ac62
parent8b70567b9446d5791fac38f48cd1308a043dbd88 (diff)
downloadao-coverage-051ff1871a163c62f1c5f5aa5ffb0ac18da49424.tar.gz
ao-coverage-051ff1871a163c62f1c5f5aa5ffb0ac18da49424.tar.bz2
ao-coverage-051ff1871a163c62f1c5f5aa5ffb0ac18da49424.zip
#11 Handle unknown paths with 404 page
-rw-r--r--public/static/404.html29
-rw-r--r--public/static/index.css4
-rw-r--r--src/routes.ts5
3 files changed, 38 insertions, 0 deletions
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 @@
+<!DOCTYPE html>
+<html lang="en-US">
+
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <meta http-equiv="x-ua-compatible" content="ie=edge" />
+ <title>Page not found - AO Coverage</title>
+ <link rel="stylesheet" type="text/css" href="/static/index.css" />
+</head>
+
+<body>
+ <div id="top-half">
+ <div id="container">
+ <div id="logo"><img src="/favicon.ico" alt="logo" /></div>
+ <h1 id="tagline">404</h1>
+ </div>
+ </div>
+ <div id="bottom-half">
+ <div id="container">
+ <div id="smallcontent">
+ <p>Oops! The page you are looking for does not exist.</p>
+ <p><a href="/">Visit the front page</a></p>
+ </div>
+ </div>
+ </div>
+</body>
+
+</html> \ 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;
};