express-cron
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-b • Public • Published

Install

npm i express-cron

Use

import express from 'express';
import expressCron from 'express-cron';

const app = express();
expressCron(app);

app.cron('* * * * *', () => {
    console.log('running every minute');
});

Only run cron jobs after app has started

import express from 'express';
import expressCron from 'express-cron';

const app = express();
expressCron(app, 'runCronJobs');

app.cron('* * * * *', () => {
    console.log('running every minute');
});

app.listen(8080, () => {
    app.emit('runCronJobs');
});

ToDo

automatically insert into dist/index.d.ts:

declare module 'express-serve-static-core' {
    export interface Application {
        cron: (schedule: string, fn: () => void) => void;
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i express-cron

Weekly Downloads

0

Version

0.0.1-b

License

ISC

Unpacked Size

1.57 kB

Total Files

3

Last publish

Collaborators

  • gaschu95