我正在尝试在我的应用程序中实现每日用户统计数据,我想在每天结束/开始时重置这些统计数据。我怎么能在 NodeJS 中做到这一点?
您可以使用node-cron。这将允许您在准确的时间运行一个函数。例如:
var CronJob = require('cron').CronJob;
new CronJob('00 00 00 * * *', () => {
console.log('This will execute on midnight');
}, null, true);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句