๐Ÿ› ๏ธ VitNode is still in development! You can try it out, but it is not recommended to use it now in production.
๐Ÿ”Œ Plugins
Task Scheduling (CRON)

Task Scheduling (CRON)

VitNode using @nestjs/schedule (opens in a new tab) to schedule tasks.

Usage

Create a service

Create a service with .cron.ts extension in your module folder.

For example in core_members create a file core_members.cron.ts with the following content:

import { Injectable } from '@nestjs/common';
import { Cron } from '@nestjs/schedule';
import { DatabaseService } from '@/database/database.service';
@Injectable()
export class CoreMembersCron {
  constructor(private databaseService: DatabaseService) {}
 
  @Cron('45 * * * * *')
  async exampleCron() {
    ...
  }
}

Register the service

Register the service in your module providers array.

import { Module } from '@nestjs/common';
@Module({
  providers: [CoreMembersCron]
})
export class CoreMembersModule {}