First we register the module at the App root module:
@Module({
imports: [
ScheduleModule.forRoot()
],
})
export class AppModule {}
2. Then we can use the `@Cron` decorator to register listeners to timed events:
```ts
@Injectable()
export class TasksService {
private readonly logger = new Logger(TasksService.name);
@Cron('45 * * * * *')
handleCron() {
this.logger.debug('Called when the current second is 45');
}
}
The ScheduleModule can be totally made using Deno native features, like the Deno.Cron module
Other than that, I think the implementation should be fairly similar to the Events feature (#76)
Is your feature request related to a problem? Please describe.
As a Nest.JS developer, I'd like the possibility of running cron jobs using the framework decorators and module system.
References:
Describe the solution you'd like
I imagine something like this:
@Module({ imports: [ ScheduleModule.forRoot() ], }) export class AppModule {}
The
ScheduleModule
can be totally made using Deno native features, like the Deno.Cron moduleOther than that, I think the implementation should be fairly similar to the
Events
feature (#76)Describe alternatives you've considered