Search posts, tags, users, and pages
As an application developer, how often do we sense the need for a service that would send e-mails to specified or subscribed email ids? Even if there is no real need, we still fantasize about it while developing a side-project or an app for fun, don'...
Tapas Adhikary
@atapas · Bangalore
Educator @tapaScript | Founder CreoWis & ReactPlay - Writer - YouTuber - Open Source
Co-Founder, @CreoWis | Teacher, @tapaScript | Founder, @ReactPlay | YouTuber | Writer | Human
Markdown supported · ⌘↵ to post
Diptom Saha
Sir, I am building an REST api in node.js.It store a meeting time and 30 before that time it's send a notifications for that particular meeting.How can I trigger this function for a particular time of every meeting.
Hello Diptom Saha,
You can use node-cron for creating a cron job if it has to be happening at a particular time of the day, day of the week, and so on.
node-cron
let cron = require('node-cron');
In your case, as the meeting time is known, the cron job can be created with the time that is meeting_time - time_offset(30 mins for example).
meeting_time - time_offset(30 mins for example)
The cron.schedule method is capable of taking the customizable pattern too.
cron.schedule('* * * * *', () => { console.log('running a task every minute'); });
Cron allowed fields are,
So when you schedule the meeting, schedule a cron also accordingly.
Hope it helps.
Diptom Saha
Sir, I am building an REST api in node.js.It store a meeting time and 30 before that time it's send a notifications for that particular meeting.How can I trigger this function for a particular time of every meeting.