Reputation: 57
I am trying to implement daily user stats into my app and I'd like to reset these stats at the end/beginning of each day. How could I do this in NodeJS?
Upvotes: 0
Views: 324
Reputation: 2241
You can use node-cron. This will allow you to run a function in exact time. As example:
var CronJob = require('cron').CronJob;
new CronJob('00 00 00 * * *', () => {
console.log('This will execute on midnight');
}, null, true);
Upvotes: 1