I am trying to scheduler a cord job at 5pm every day using nestjs.
@Cron('10 * * * * *')
async handleCron() {
const country = await this.countryRepo.find();
country.map(async (value) => {
...doing something
});
}
I am trying to scheduler a cord job at 5pm every day using nestjs.
@Cron('10 * * * * *')
async handleCron() {
const country = await this.countryRepo.find();
country.map(async (value) => {
...doing something
});
}
You can simply use the cron expression:
@Cron('0 0 17 * * *')
Meaning at 17:00:00 every day
The @nestjs/schedule also offers cron expression alias:
So you can do:
@Cron(CronExpression.EVERY_DAY_AT_5PM)
Which is more readable