From ae92866b21e5b85fc8c0439a5be6f7d777fd9647 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Sat, 7 Dec 2019 15:25:14 -0600 Subject: Clean up routing, add misc --- src/html/admin.html | 37 +++++++-- src/html/index.html | 1 + src/html/misc.html | 32 ++++++++ src/html/snake.html | 216 ---------------------------------------------------- src/server.js | 8 +- 5 files changed, 66 insertions(+), 228 deletions(-) create mode 100644 src/html/misc.html delete mode 100644 src/html/snake.html diff --git a/src/html/admin.html b/src/html/admin.html index a97af06..363f5c0 100644 --- a/src/html/admin.html +++ b/src/html/admin.html @@ -14,13 +14,17 @@ el: '#stats', data: { stats: { session: [], url: [] }, + emails: [], showSessionTable: false, showUrlTable: false, showLogData: false, + showEmailData: false, }, created() { fetch(new Request('/admin/stats')).then(response => response.json()) .then(response => this.stats = response); + fetch(new Request('/admin/emails')).then(response => response.json()) + .then(response => this.emails = response); } }); } @@ -57,12 +61,27 @@ +
+ Chess +

Stats

+
+ + +
+
+ + +
+
+ + +
{{stats.total}} total sessions @@ -76,10 +95,6 @@
-
- - -
@@ -92,10 +107,6 @@
Method{{item.c}}
-
- - -
@@ -111,6 +122,16 @@
Date{{item.c}}
+ + + + + + + + + +
NameAddress
{{item.name}}{{item.address}}
diff --git a/src/html/index.html b/src/html/index.html index 1d57609..ce67842 100644 --- a/src/html/index.html +++ b/src/html/index.html @@ -33,6 +33,7 @@ Blog Email + Misc
diff --git a/src/html/misc.html b/src/html/misc.html new file mode 100644 index 0000000..60455c5 --- /dev/null +++ b/src/html/misc.html @@ -0,0 +1,32 @@ + + + + + Mark's Kitchen + + + + + + + + + + + +

+ < + Miscellany +

+
+ Projects +
+
+ Chess +
+
+ Word Play + + + + \ No newline at end of file diff --git a/src/html/snake.html b/src/html/snake.html deleted file mode 100644 index e2158e5..0000000 --- a/src/html/snake.html +++ /dev/null @@ -1,216 +0,0 @@ - - - - - Snake - - - - - - - - - - - \ No newline at end of file diff --git a/src/server.js b/src/server.js index b3a39bd..72cc417 100644 --- a/src/server.js +++ b/src/server.js @@ -97,7 +97,7 @@ function setUpRoutes(models, jwtFunctions, database) { server.get('/tags', (req, res) => res.sendFile(__dirname + "/html/tags.html")); server.get('/feed', (req, res) => res.sendFile(__dirname + "/html/feed.html")); server.get('/essay', (req, res) => res.sendFile(__dirname + "/html/essay.html")); - server.get('/snake', (req, res) => res.sendFile(__dirname + "/html/snake.html")); + server.get('/misc', (req, res) => res.sendFile(__dirname + "/html/misc.html")); server.get('/word-square', (req, res) => res.sendFile(__dirname + "/html/word-square.html")); server.get('/chess', (req, res) => res.sendFile(__dirname + "/html/chess.html")); server.get('/admin/chess', async (req, res, next) => res.sendFile(__dirname + "/html/chess.html")); @@ -127,9 +127,9 @@ function setUpRoutes(models, jwtFunctions, database) { //var game = await database.query("select * from chessgames where name = '"+name+"'", { type: database.QueryTypes.SELECT }) res.status(200).send({game:game}); }) - server.get('/setScore', (req, res) => { - request(`http://localhost:8000?${req.url.split("?")[1]}`, function (error, response, body) { - }); + server.get('/admin/emails', async (req, res, next) => { + var emails = await models.emails.findAll(); + res.status(200).send(emails); }) server.get('/admin/stats', async (req, res, next) => { try { -- cgit v1.2.3