dockerizing_project #3

Merged
kfir merged 7 commits from dockerizing_project into master 2023-04-02 13:43:23 +00:00
3 changed files with 10 additions and 7 deletions
Showing only changes of commit 49b42b83b9 - Show all commits

View file

@ -1,2 +1,4 @@
node_modules node_modules
npm-debug.log npm-debug.log
src
tmp

View file

@ -1,4 +1,4 @@
FROM node:latest FROM node:16
# Create app directory # Create app directory
WORKDIR /usr/src/app WORKDIR /usr/src/app

View file

@ -40,17 +40,18 @@ class App {
const app = new App(); const app = new App();
console.log("Declaring Cron Job every day at 10:00") console.log("Declaring Cron Job every day at 10:00")
const cron = "0 10 * * *" // every day at 10:00
const job = new CronJob( const job = new CronJob(
"* * * * *", "0 10 * * *", // every day at 10:00,
async () => { async () => {
console.log("START") console.log("Staring a new job")
const outputFileLocation = 'public/maccabi-haifa-fc.ics'; const outputFileLocation = 'public/maccabi-haifa-fc.ics';
console.log("Getting games from Haifa")
const games = await app.gameSource.getGamesFromHaifa(); const games = await app.gameSource.getGamesFromHaifa();
console.log("Generating ICS file")
const icsEvents = app.ics.generateIcsOutputFromGames(games); const icsEvents = app.ics.generateIcsOutputFromGames(games);
console.log("Writing ICS file to " + outputFileLocation)
fs.writeFileSync(outputFileLocation, icsEvents); fs.writeFileSync(outputFileLocation, icsEvents);
console.log("END") console.log("Done")
}, },
null, null,
true, true,