Skip to content

Cron

function Cron(pattern, options?): MethodDecorator;

Defined in: tsed/src/decorators/cron.ts:23

Method decorator that registers a method as a scheduled cron job.

ParameterTypeDescription
patternstringCron expression (e.g., ”* * * * *”, “@daily”)
options?CronDecoratorOptionsOptional cron configuration (name, timezone, etc.)

MethodDecorator

@JobController()
class ReportJobs {
  @Cron("@daily", { timezone: "UTC" })
  async generateDailyReport() {
    // ...
  }
}