@kingworldjs/cron
v0.0.0-experimental.1
Published
A plugin for kingworld that add support for running cronjob
Downloads
2
Readme
@kingworldjs/cron
A plugin for kingworld that add support for running cronjob.
Installation
bun add @kingworldjs/cron
Example
import { KingWorld } from 'kingworld'
import '@kingworldjs/cron'
const app = new KingWorld()
.cron({
name: 'heartbeat',
pattern: '*/1 * * * * *'
}, () => {
console.log("Heartbeat")
})
.get('/stop', ({ store: { cron: { heartbeat } } }) => {
heartbeat.stop()
return 'Stop heartbeat'
})
.listen(8080)
API
This plugin extends cron
method to KingWorld using cronner
For documentation, app.cron
use the same syntax as cronner, so please refers to cronner documentation