패키지 설치
npm install node-cron
사용
const import cron from 'node-cron';
cron.schedule('0 9,22 * * *', async () => {
await knex('target_table').truncate();
await knex('cars').update({ capacity: 7 });
}, { timezone: 'Asia/Seoul' });
cron
문법: 분 시 일 월 요일
예: 0 9,22 * * * (매일 9:00, 22:00)