diff --git a/routes/db/bonus.js b/routes/db/bonus.js
index 6060cd1ab..1a134c942 100644
--- a/routes/db/bonus.js
+++ b/routes/db/bonus.js
@@ -7,6 +7,12 @@ import fs from 'fs';
import { ObjectId } from 'mongodb';
const router = Router();
+const head = fs.readFileSync('./client/head.html', 'utf8');
+const nav = fs.readFileSync('./client/nav/index.html', 'utf8');
+const file = fs.readFileSync('./client/db/bonus/index.html', 'utf8')
+ .replace('', head)
+ .replace('', nav);
+
function removeParentheses (answer) {
return answer.replace(/[([].*/g, '');
}
@@ -21,7 +27,6 @@ router.get('/', async (req, res) => {
if (!bonus) { return res.sendStatus(404); }
const description = `Bonus: ${bonus.answers_sanitized.map(a => escapeHTML(removeParentheses(a))).join(' / ')} [${bonus.set.name}]`;
- const file = fs.readFileSync('./client/db/bonus/index.html', { encoding: 'utf8' });
res.send(file.replace('', ``));
});
diff --git a/routes/db/tossup.js b/routes/db/tossup.js
index 5b00a6657..06e2d3d07 100644
--- a/routes/db/tossup.js
+++ b/routes/db/tossup.js
@@ -7,6 +7,12 @@ import fs from 'fs';
import { ObjectId } from 'mongodb';
const router = Router();
+const head = fs.readFileSync('./client/head.html', 'utf8');
+const nav = fs.readFileSync('./client/nav/index.html', 'utf8');
+const file = fs.readFileSync('./client/db/tossup/index.html', 'utf8')
+ .replace('', head)
+ .replace('', nav);
+
function removeParentheses (answer) {
return answer.replace(/[([].*/g, '');
}
@@ -21,7 +27,6 @@ router.get('/', async (req, res) => {
if (!tossup) { return res.sendStatus(404); }
const description = `Tossup: ${escapeHTML(removeParentheses(tossup.answer_sanitized))} [${tossup.set.name}]`;
- const file = fs.readFileSync('./client/db/tossup/index.html', { encoding: 'utf8' });
res.send(file.replace('', ``));
});