aboutsummaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@gmail.com>2022-10-17 10:59:43 +0300
committerJoel Kronqvist <work.joelkronqvist@gmail.com>2022-10-17 10:59:43 +0300
commit22a4830bb09cbecf6c2e8e52601a4e821bddbe8e (patch)
tree43db3f30041f63cbc98fac9da331e6e256f7f870 /server.js
parentc38a4cfc0d9c8dbd91c07b03a393a0dd89721b5a (diff)
downloadLYLLRuoka-22a4830bb09cbecf6c2e8e52601a4e821bddbe8e.tar.gz
LYLLRuoka-22a4830bb09cbecf6c2e8e52601a4e821bddbe8e.zip
Imroved README.md, modified server to update on start
Also minor changes to setup.sh and update.js. In update.js the updation function was changed to take a database connection (as in database.js) instead of a string with the credentials to the DB.
Diffstat (limited to 'server.js')
-rw-r--r--server.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/server.js b/server.js
index 3172e75..fcfa1ea 100644
--- a/server.js
+++ b/server.js
@@ -8,6 +8,7 @@ const DBPARSE = require("./dbparse.js");
const open = require("./Functions/open.js");
const strFuncs = require("./Functions/stringFuncs.js");
const dateFuncs = require("./Functions/dateFuncs.js");
+const updateDB = require("./update.js");
async function init()
@@ -44,7 +45,11 @@ async function init()
// get the MySQL DB connection
const SQLDB = new SQL_DBS.Database(JSON.parse(dbcredentials));
- // Add the foods to the database
+ // Update...
+ // ...shifts and classes
+ await updateDB.update(SQLDB, "../Updation/shifts.txt", "../Updation/vanhalops.csv", "../Updation/uusilops.csv");
+ console.log("Shifts and classes updated.");
+ // ...foods
await food.build(SQLDB);
setInterval(
() =>
@@ -53,6 +58,7 @@ async function init()
},
7 * 24 * 60 * 60 * 1000
);
+ console.log("Foods updated.")
// server code
async function server(req, res)
@@ -100,6 +106,7 @@ async function init()
// start servers
const httpsServer = https.createServer(httpsOpts, server).listen(443);
const httpServer = http.createServer(server).listen(80);
+ console.log("Servers Up And Running!")
// stop server
async function closeServers() {