diff options
author | Joel Kronqvist <work.joelkronqvist@gmail.com> | 2022-10-17 10:59:43 +0300 |
---|---|---|
committer | Joel Kronqvist <work.joelkronqvist@gmail.com> | 2022-10-17 10:59:43 +0300 |
commit | 22a4830bb09cbecf6c2e8e52601a4e821bddbe8e (patch) | |
tree | 43db3f30041f63cbc98fac9da331e6e256f7f870 /server.js | |
parent | c38a4cfc0d9c8dbd91c07b03a393a0dd89721b5a (diff) | |
download | LYLLRuoka-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.js | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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() { |