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

1.0.3 • Public • Published

@elysiajs/cron

Plugin for elysia that add support for running cronjob.

Installation

bun add @elysiajs/cron

Example

import { Elysia } from 'elysia'
import { cron } from '@elysiajs/cron'

const app = new Elysia()
    use(
        cron({
            name: 'heartbeat',
            pattern: '*/1 * * * * *',
            run() {
                console.log("Heartbeat")
            }
        }
    )
    .get('/stop', ({ store: { cron: { heartbeat } } }) => {
        heartbeat.stop()

        return 'Stop heartbeat'
    })
    .listen(8080)

API

This plugin export cron function using cronner

For documentation, cron use the same syntax as cronner, so please refers to cronner documentation

Readme

Keywords

Package Sidebar

Install

npm i @elysiajs/cron

Weekly Downloads

1,507

Version

1.0.3

License

MIT

Unpacked Size

39.8 kB

Total Files

13

Last publish

Collaborators

  • aomkirby123