dockerizing_project #3
3 changed files with 10 additions and 7 deletions
|
@ -1,2 +1,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
src
|
||||||
|
tmp
|
|
@ -1,4 +1,4 @@
|
||||||
FROM node:latest
|
FROM node:16
|
||||||
|
|
||||||
# Create app directory
|
# Create app directory
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
11
src/index.ts
11
src/index.ts
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue