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: 3 months 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 (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-16T11:57:26.000Z (4 months ago)
- Last Synced: 2024-07-29T11:35:36.586Z (4 months ago)
- Language: TypeScript
- Size: 324 KB
- Stars: 10
- Watchers: 1
- Forks: 7
- Open Issues: 7
-
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)