-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
37 lines (33 loc) · 1.19 KB
/
server.js
File metadata and controls
37 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const dynamicSettings = require('yargs').argv
const scrapPostService = require('./app/services/scrap-post.service.js')
if (dynamicSettings.env === 'PROD') {
const cronJobService = require('./app/services/cron-job.service.js')
const namesDayCronJob = cronJobService.addChronJob({
description: 'Vardadieniai (namesday) scrap & post',
timezone: 'Europe/Riga',
days: [0, 1, 2, 3, 4, 5, 6],
times: ['12:00'],
job: scrapPostService.namesdays.bind(scrapPostService)
})
namesDayCronJob.start()
const jokesCronJob = cronJobService.addChronJob({
description: 'Joke scrap & post',
timezone: 'Europe/Riga',
days: [0, 1, 2, 3, 4, 5, 6],
times: ['15:00', '19:00'],
job: scrapPostService.jokes.bind(scrapPostService)
})
jokesCronJob.start()
const weatherAndCelebrationsCronJob = cronJobService.addChronJob({
description: 'Weather & celebrations scrap & post',
timezone: 'Europe/Riga',
days: [0, 1, 2, 3, 4, 5, 6],
times: ['09:00'],
job: scrapPostService.weatherAndCelebrations.bind(scrapPostService)
})
weatherAndCelebrationsCronJob.start()
} else {
scrapPostService.namesdays()
scrapPostService.jokes()
scrapPostService.weatherAndCelebrations()
}