Reputation: 33
So I am making an app about weekly statistics and in my backend I want to make it reset all of my stats at Sunday 23:59 pm each week. How should i go about this so it does not disturb the rest of my backend, it is written in javascript and node (express)?
Upvotes: 1
Views: 763
Reputation: 4877
You can use the cron
package in Node to do it.
var CronJob = require('cron').CronJob;
var job = new CronJob('0 59 23 * * 0', function() {
console.log('You will see this message every Sunday at 23:59');
}, null, true, 'America/Los_Angeles');
job.start();
Upvotes: 0
Reputation: 471
You can achieve that using a cron job. I will send you a link to an article hopefully that will help you complete your application.node cron jobs by example
#cheers
Upvotes: 0