Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 404 page #312

Merged
merged 2 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules

**/.DS_store
.env
.vs/
85 changes: 85 additions & 0 deletions client/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!doctype html>
<html lang="en">

<head>
<title>QB Reader</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="QB Reader - Page not found.">

<link href="/apple-touch-icon.png" rel="apple-touch-icon">
<link href="/apple-touch-icon-precomposed.png" rel="apple-touch-icon-precomposed">
<link type="image/x-icon" href="/favicon.ico" rel="icon">

<link href="/bootstrap/light.css" rel="stylesheet">
<link href="/bootstrap/dark.css" rel="stylesheet" id="custom-css">
<script type="module" src="/scripts/apply-theme.js"></script>
</head>

<body>
<nav class="navbar navbar-light navbar-expand-lg bg-custom" id="navbar" style="z-index: 10">
<div class="container-fluid">
<a class="navbar-brand ms-1 py-0" id="logo" href="/">
<span class="logo-prefix">QB</span><span class="logo-suffix">Reader</span>
</a>
<button class="navbar-toggler" data-bs-target="#navbarSupportedContent" data-bs-toggle="collapse" type="button"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="/singleplayer">Singleplayer</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/multiplayer">Multiplayer</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="/db" aria-current="page">Database</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/frequency-list">Frequency List</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/geoword">Geoword</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/api-docs">API</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/settings">Settings</a>
</li>
</ul>
<div class="d-flex">
<ul class="navbar-nav mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="/user/login" id="login-link">Log in</a>
</li>
</ul>
</div>
</div>
</div>
</nav>

<div class="container mt-3">
<h1>Page Not Found</h1>
<br />
<p><b>Rarely-used examples of these objects are named "Early Hints", "Variant Also Negotiates" and "Non-Authoritative
Information". A 2016 proposal by Tim Bray to create a new one of these objects ends with the acknowledgement, "Thanks
also to Ray Bradbury". That proposed object is named "Unavailable For Legal Reasons". An unofficial one of these
objects used by Twitter's API is named for a quote from Demolition Man, "Enhance your calm". A Google easter egg
produces one of these objects with the note, "The requested entity body is short and stout", in reference to a joke
</b>(*) "Coffee Pot Control Protocol" that introduced one of these things called "I'm a teapot". The 300 series of these
things indicate a redirection, while the 200 series indicates success. For 10 points, identify these three-digit
identifiers that include "502 Bad Gateway" and "404 Not Found".</p>
<hr />
<p><b>ANSWER: <u>HTTP status</u> codes</b> [accept <b><u>HTTP error codes</u></b>; accept <b><u>HTTP codes</u></b>; prompt on
"<u>HTTP responses</u>" with "what part of the response?"; prompt on "<u>status</u> codes" or "<u>error</u> codes" with
"under what protocol?"; anti-prompt on specific codes like "404 Not Found" with "can you be less specific?"]</p>
</div>
</body>

</html>
18 changes: 13 additions & 5 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import userRouter from './user.js';
import webhookRouter from './api/webhook.js';

import express, { Router } from 'express';

const router = Router();

router.get('/*.scss', (req, res) => {
Expand All @@ -16,11 +17,11 @@ router.get('/*.scss', (req, res) => {
/**
* Redirects:
*/
router.get('/api-info', (req, res) => res.redirect('/api-docs'));
router.get('/bonuses', (req, res) => res.redirect('/singleplayer/bonuses'));
router.get('/db', (req, res) => res.redirect('/database'));
router.get('/tossups', (req, res) => res.redirect('/singleplayer/tossups'));
router.get('/user', (req, res) => res.redirect('/user/login'));
router.get('/api-info', (_req, res) => res.redirect('/api-docs'));
router.get('/bonuses', (_req, res) => res.redirect('/singleplayer/bonuses'));
router.get('/db', (_req, res) => res.redirect('/database'));
router.get('/tossups', (_req, res) => res.redirect('/singleplayer/tossups'));
router.get('/user', (_req, res) => res.redirect('/user/login'));

/**
* Routes:
Expand All @@ -36,4 +37,11 @@ router.use('/webhook', webhookRouter);
router.use(express.static('client', { extensions: ['html'] }));
router.use(express.static('node_modules'));

/**
* 404 Error handler
*/
router.use((_req, res) => {
res.sendFile('404.html', { root: './client' });
});

export default router;
Loading