Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beliven-it/fastify-crons
A plugin to schedule cron jobs
https://github.com/beliven-it/fastify-crons
cron fastify jobs js node-cron nodejs
Last synced: about 2 months ago
JSON representation
A plugin to schedule cron jobs
- Host: GitHub
- URL: https://github.com/beliven-it/fastify-crons
- Owner: beliven-it
- License: mit
- Created: 2020-06-11T14:39:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T20:57:22.000Z (almost 2 years ago)
- Last Synced: 2024-10-18T05:36:51.697Z (2 months ago)
- Topics: cron, fastify, jobs, js, node-cron, nodejs
- Language: JavaScript
- Homepage:
- Size: 892 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fastify-crons
A plugin to schedule cron jobs
https://en.wikipedia.org/wiki/Cron
![Node.js CI](https://github.com/heply/fastify-crons/workflows/Node.js%20CI/badge.svg)
## Install
```bash
$ npm i --save fastify-crons
```## Usage
```js
fastify.register(require('fastify-crons'), {
timezone: 'Europe/Rome'
})fastify.crons.schedule('*/2 * * * *', () => {
console.log('Hi!')
})// OR:
const task = fastify.crons.schedule('*/2 * * * *', () => {
console.log('Hi!')
}, {
scheduled: false
})task.start()
```Under the hood, [node-cron](https://www.npmjs.com/package/node-cron#options) is used.
## Options
| Name | Description |
|-------------|---------------------------------------------------------------------------------------------|
| `timezone` | Can be used to set the global reference timezone for all scheduled jobs. By default is UTC. |## Test
```bash
$ npm test
```## Acknowledgements
This project is kindly sponsored by:
[![Beliven](https://assets.beliven.com/brand/logo_pos_color.svg)](https://www.beliven.com)
## License
Licensed under [MIT](./LICENSE)