-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
27 lines (23 loc) · 788 Bytes
/
index.js
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
import { CronJob } from 'cron';
import { config } from './config.js';
import { createServer } from './server.js';
import { passController, reservationController } from './src/application/index.js';
import { authService } from './src/infrastructure/AuthService.js';
import { logger } from './src/infrastructure/Logger.js';
const parisTimezone = 'Europe/Paris';
main();
async function main() {
CronJob.from({
cronTime: config.cronTime,
onTick: async () => {
logger.info('Start job');
await reservationController.handleReservations();
logger.info('End job');
},
start: true,
runOnInit: true,
timeZone: parisTimezone,
});
const server = await createServer({ reservationController, authService, passController });
await server.start();
};