aboutsummaryrefslogtreecommitdiff
path: root/src/server.js
diff options
context:
space:
mode:
authorMark Powers <markppowers0@gmail.com>2019-07-16 18:42:28 -0400
committerMark Powers <markppowers0@gmail.com>2019-07-16 18:42:28 -0400
commita73da0d736a50b7fb10f010b9ae4cc3e551c59e7 (patch)
tree3fc2dc724505c515e7c71ffc1dc61a0176700a0e /src/server.js
parent7d0aa00e74b1ed2ea2cab9afaf8eb7b7f9280d3d (diff)
Add email form
Diffstat (limited to 'src/server.js')
-rw-r--r--src/server.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/server.js b/src/server.js
index eae99e4..9899736 100644
--- a/src/server.js
+++ b/src/server.js
@@ -84,6 +84,7 @@ function setUpRoutes(models, jwtFunctions, database) {
server.get('/index', (req, res) => res.sendFile(__dirname + "/html/index.html"))
server.get('/admin', (req, res) => res.sendFile(__dirname + "/html/admin.html"));
server.get('/login', (req, res) => res.sendFile(__dirname + "/html/login.html"))
+ server.get('/email', (req, res) => res.sendFile(__dirname + "/html/email.html"))
server.get('/bread', (req, res) => res.sendFile(__dirname + "/html/bread.html"));
server.get('/blog', (req, res) => res.sendFile(__dirname + "/html/blog.html"));
server.get('/tags', (req, res) => res.sendFile(__dirname + "/html/tags.html"));
@@ -175,6 +176,16 @@ function setUpRoutes(models, jwtFunctions, database) {
res.redirect('/login');
}
})
+ server.post('/email', async (req, res, next) => {
+ const name = req.body.name;
+ const email = req.body.email;
+ if (name && email) {
+ models.emails.create({"name": name, "address": email})
+ res.redirect('/email#success');
+ } else {
+ console.debug("Error with email submission")
+ }
+ })
server.get('/favicon.ico', (req, res) => res.sendFile(__dirname + "/icon/favicon.ico"))