From 0e58a4e12cdf4a6fbbc3338773c14e2d8971277e Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Thu, 3 Oct 2024 01:21:57 +0300 Subject: [PATCH] Schedule cron job --- server.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 6e4819c..4fba8e0 100644 --- a/server.js +++ b/server.js @@ -149,8 +149,9 @@ END:VEVENT icalString += `END:VCALENDAR`; fs.writeFileSync(filename, icalString); - // Update the merged calendar URL - const mergedCalendarUrl = `${req.protocol}://${req.get('host')}/${filename}`; + // Generate a unique URL for the merged calendar + const mergedCalendarUrl = `http://localhost:3000/${filename}`; + console.log(`Merged calendar updated: ${mergedCalendarUrl}`); } catch (error) { @@ -168,7 +169,7 @@ setInterval(() => { // Schedule a cron job to update the merged calendar every hour cron.schedule('0 * * * *', () => { console.log('Updating merged calendar...'); - // TO DO: implement the logic to update the merged calendar + updateMergedCalendar(); }); // Start the server