*: stubbing out a page for "what's this about?"
All checks were successful
Basic Checking / Explore-Gitea-Actions (push) Successful in 28s

Fixes #2

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2023-09-28 16:57:48 -04:00
parent 31408d4536
commit dbc7509fbd
Signed by: vbatts
GPG key ID: E30EFAA812C6E5ED
5 changed files with 69 additions and 6 deletions

10
app.js
View file

@ -1,6 +1,6 @@
const express = require("express");
const fs = require("fs");
const path = require("path");
const join = require("path").join;
const morgan = require("morgan");
const bodyParser = require("body-parser");
const sqlite3 = require("sqlite3").verbose();
@ -37,12 +37,13 @@ const db = new sqlite3.Database(config.db_path, (err) => {
});
var accessLogStream = fs.createWriteStream(
path.join(__dirname, "log", "access.log"),
join(__dirname, "log", "access.log"),
{ flags: "a" },
);
app.use(bodyParser.json());
app.use(morgan("combined", { stream: accessLogStream }));
app.use(express.static(join(__dirname, './wwwroot')));
var animals;
// check and load animals into redis
@ -77,10 +78,7 @@ try {
// Serve the HTML file
app.get("/", (req, res) => {
res.sendFile(__dirname + "/index.html");
});
app.get("/asset/frontend.js", (req, res) => {
res.sendFile(__dirname + "/asset/frontend.js");
res.sendFile(__dirname + "/wwwroot/index.html");
});
// Route to get a random animal name

View file

@ -9,6 +9,20 @@ describe('GET /', () => {
//expect(response.body.message).toBe('Hello, World!');
});
});
describe('GET /index.html', () => {
it('should respond with 200 status', async () => {
const response = await request(app).get('/index.html');
expect(response.statusCode).toBe(200);
//expect(response.body.message).toBe('Hello, World!');
});
});
describe('GET /what.html', () => {
it('should respond with 200 status', async () => {
const response = await request(app).get('/what.html');
expect(response.statusCode).toBe(200);
//expect(response.body.message).toBe('Hello, World!');
});
});
describe('GET /asset/frontend.js', () => {
it('should respond with 200 status', async () => {

View file

@ -20,6 +20,12 @@
</p>
</div>
<div id="whatsThisAllAbout">
<p>
<a id="whatsThisAllAboutLink" href="what.html">(what's this all about?)</a>
</p>
</div>
<div id="footer">
© 2023. All rights reserved. <a href="mailto:isacritter@hashbangbash.com">isacritter</a>; <a href="https://paypal.me/vbatts/1" target="_blank">keep isacritter alive</a>
</div>
@ -34,6 +40,9 @@
#startOver {
text-align: center;
}
#whatsThisAllAbout {
text-align: center;
}
#footer {
bottom: 2px;
height: 40px;

42
wwwroot/what.html Normal file
View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Is this a Critter?</title>
<meta name="description" content="Is this a critter? Trying to agree on what a critter even is requires a bit of sampling. Help by contributing your vote on what a critter even is."/>
</head>
<body>
<div id="isCritter">
<h3>What's this all about?</h3>
</div>
<div id="back">
<p>
<a id="backLink" href="/">(back to the critters)</a>
</p>
</div>
<div id="footer">
© 2023. All rights reserved. <a href="mailto:isacritter@hashbangbash.com">isacritter</a>; <a href="https://paypal.me/vbatts/1" target="_blank">keep isacritter alive</a>
</div>
<style type="text/css">
#isCritter {
text-align: center;
}
#back {
text-align: center;
}
#footer {
bottom: 2px;
height: 40px;
margin-top: 40px;
text-align: center;
vertical-align: middle;
position: fixed;
width: 100%;
}
</style>
</body>
</html>