Skip to content

Plugin for Elysia that add support for running cronjob

License

Notifications You must be signed in to change notification settings

oDeano/elysia-cron

 
 

Repository files navigation

@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

About

Plugin for Elysia that add support for running cronjob

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 92.2%
  • JavaScript 7.8%