From 4fd447104b7f9de6c0819cccc74f3a8caeed6bfb Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Wed, 2 Oct 2024 14:32:35 +0300 Subject: [PATCH] create function to update merged calendar, and in it load the calendar data from calendars.jsonfile --- server.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index fe9ddd9..f223c4c 100644 --- a/server.js +++ b/server.js @@ -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...');