Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elysiajs/elysia-cron
Plugin for Elysia that add support for running cronjob
https://github.com/elysiajs/elysia-cron
Last synced: 11 days ago
JSON representation
Plugin for Elysia that add support for running cronjob
- Host: GitHub
- URL: https://github.com/elysiajs/elysia-cron
- Owner: elysiajs
- License: mit
- Created: 2022-12-04T14:14:54.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-26T04:37:08.000Z (18 days ago)
- Last Synced: 2024-11-29T00:25:15.519Z (15 days ago)
- Language: TypeScript
- Size: 197 KB
- Stars: 14
- Watchers: 1
- Forks: 6
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-elysia - cron - Plugin that add support for running cronjob. (Plugins)
README
# @elysiajs/cron
Plugin for [elysia](https://github.com/elysiajs/elysia) that add support for running cronjob.## Installation
```bash
bun add @elysiajs/cron
```## Example
```typescript
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](https://github.com/hexagon/croner)For documentation, `cron` use the same syntax as [cronner](https://github.com/hexagon/croner), so please refers to [cronner documentation](https://github.com/hexagon/croner)