fastify-crons

0.1.0 • Public • Published

fastify-crons

A plugin to schedule cron jobs

https://en.wikipedia.org/wiki/Cron

Node.js CI

Install

$ npm i --save fastify-crons

Usage

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 is used.

Options

Name Description
timezone Can be used to set the global reference timezone for all scheduled jobs. By default is UTC.

Test

$ npm test

Acknowledgements

This project is kindly sponsored by:

Beliven

License

Licensed under MIT

Package Sidebar

Install

npm i fastify-crons

Weekly Downloads

28

Version

0.1.0

License

MIT

Unpacked Size

4.37 kB

Total Files

6

Last publish

Collaborators

  • beliven.dev