In order to register cron jobs, they need to be passed via the options you pass to joystick.app()
.
Example Usage
index.server.js
import joystick from '@joystick.js/node';
import cron_jobs from './cron_jobs/index.js';
joystick.app({
cron_jobs,
routes: { ... }
});
Above, we've imported an assumed file containing all of our cron jobs from /cron_jobs/index.js
. We expect that file to have a default export of an object containing all of our cron job definitions.
API
Definition
joystick.app({
cron_jobs: {
cron_job_name: {
log_at_run_time: string,
schedule: string,
run: () => void
}
}
})
Parameters
- cron_jobs object
- An object containing your cron job definitions. Each key is the cron job name and its value is an object defining that cron job's options and run logic.