1
0
Fork 0

create function to update merged calendar, and in it load the calendar data from calendars.jsonfile

This commit is contained in:
Ryan Mwangi 2024-10-02 14:32:35 +03:00
parent 4548e452ac
commit 4fd447104b
1 changed files with 8 additions and 1 deletions

View File

@ -97,7 +97,14 @@ app.listen(port, () => {
console.log(`Server started on port ${port}`);
});
// Function to update the merged calendar
async function updateMergedCalendar(){
try {
// Load calendars data from file
const calendarsFile = 'calendars.json';
const calendars = JSON.parse(fs.readFileSync(calendarsFile, 'utf8'));
}
}
// Schedule a cron job to update the merged calendar every hour
cron.schedule('0 * * * *', () => {
console.log('Updating merged calendar...');