I wanted to make a function which will send the list of users a notification (Email) and want this to continue after every 6 hrs regularly. Something like this
function(){
if(currentTime==scheduledTime){
//Triger notification sender
sendNotification();
scheduledTime = (scheduledTime + 6 hrs);
}
}
How can I implement this Feature. Also, where can I deploy this website with this kind of functionality for free.
You can use node-cron instead.You can setup the interval using cron syntax and it will run in a scheduled manner.
npm install --save node-cron
Then :
var cron = require('node-cron');
cron.schedule('* */6 * * *', () => {
console.log('running a task every 6 hours');
sendNotification();
});