@kingworldjs/cron
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-experimental.1 • Public • Published

@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

Readme

Keywords

Package Sidebar

Install

npm i @kingworldjs/cron

Weekly Downloads

1

Version

0.0.0-experimental.1

License

MIT

Unpacked Size

13.6 kB

Total Files

16

Last publish

Collaborators

  • aomkirby123