*: stubbing out a page for "what's this about?"
All checks were successful
Basic Checking / Explore-Gitea-Actions (push) Successful in 28s
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:
parent
31408d4536
commit
dbc7509fbd
5 changed files with 69 additions and 6 deletions
10
app.js
10
app.js
|
@ -1,6 +1,6 @@
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const join = require("path").join;
|
||||||
const morgan = require("morgan");
|
const morgan = require("morgan");
|
||||||
const bodyParser = require("body-parser");
|
const bodyParser = require("body-parser");
|
||||||
const sqlite3 = require("sqlite3").verbose();
|
const sqlite3 = require("sqlite3").verbose();
|
||||||
|
@ -37,12 +37,13 @@ const db = new sqlite3.Database(config.db_path, (err) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
var accessLogStream = fs.createWriteStream(
|
var accessLogStream = fs.createWriteStream(
|
||||||
path.join(__dirname, "log", "access.log"),
|
join(__dirname, "log", "access.log"),
|
||||||
{ flags: "a" },
|
{ flags: "a" },
|
||||||
);
|
);
|
||||||
|
|
||||||
app.use(bodyParser.json());
|
app.use(bodyParser.json());
|
||||||
app.use(morgan("combined", { stream: accessLogStream }));
|
app.use(morgan("combined", { stream: accessLogStream }));
|
||||||
|
app.use(express.static(join(__dirname, './wwwroot')));
|
||||||
|
|
||||||
var animals;
|
var animals;
|
||||||
// check and load animals into redis
|
// check and load animals into redis
|
||||||
|
@ -77,10 +78,7 @@ try {
|
||||||
|
|
||||||
// Serve the HTML file
|
// Serve the HTML file
|
||||||
app.get("/", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
res.sendFile(__dirname + "/index.html");
|
res.sendFile(__dirname + "/wwwroot/index.html");
|
||||||
});
|
|
||||||
app.get("/asset/frontend.js", (req, res) => {
|
|
||||||
res.sendFile(__dirname + "/asset/frontend.js");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Route to get a random animal name
|
// Route to get a random animal name
|
||||||
|
|
14
app.test.js
14
app.test.js
|
@ -9,6 +9,20 @@ describe('GET /', () => {
|
||||||
//expect(response.body.message).toBe('Hello, World!');
|
//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', () => {
|
describe('GET /asset/frontend.js', () => {
|
||||||
it('should respond with 200 status', async () => {
|
it('should respond with 200 status', async () => {
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="whatsThisAllAbout">
|
||||||
|
<p>
|
||||||
|
<a id="whatsThisAllAboutLink" href="what.html">(what's this all about?)</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="footer">
|
<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>
|
© 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>
|
</div>
|
||||||
|
@ -34,6 +40,9 @@
|
||||||
#startOver {
|
#startOver {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
#whatsThisAllAbout {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
#footer {
|
#footer {
|
||||||
bottom: 2px;
|
bottom: 2px;
|
||||||
height: 40px;
|
height: 40px;
|
42
wwwroot/what.html
Normal file
42
wwwroot/what.html
Normal 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>
|
Loading…
Reference in a new issue