Saltearse al contenido
sern

Tasks

Esta página aún no está disponible en tu idioma.

Your app may need to execute tasks in the future on intervals or over a long time. If you haven’t already, add the tasks directory to your config

1
export const tasks = "./dist/tasks"

The snippet below defines a task that runs every minute. Keep in mind that the file name is just a unique identifier and you can name it however you want.

./src/tasks/every-minute.js
1
import { scheduledTask } from "@sern/handler";
2
3
export default scheduledTask({
4
trigger: "* * * * *",
5
execute: (context) => {
6
console.log("cron cron")
7
}
8
})

The trigger is a cron tab pattern, you can edit and test one here.