serve updated merged calendar to user

This commit is contained in:
Ryan Mwangi 2024-10-08 22:13:25 +03:00
parent e01c54e267
commit 3d31d039d8
2 changed files with 7 additions and 1 deletions

0
merged_calendar_url.txt Normal file
View File

View File

@ -185,13 +185,19 @@ END:VEVENT
}
}
// Schedule a cron job to update the merged calendar every hour
cron.schedule('0 * * * *', () => {
console.log('Updating merged calendar...');
updateMergedCalendar();
});
// serve updated merged calendar to user
app.get('/merged-calendar', (req, res) => {
const mergedCalendarUrlFile = 'merged_calendar_url.txt';
const mergedCalendarUrl = fs.readFileSync(mergedCalendarUrlFile, 'utf8');
res.redirect(mergedCalendarUrl);
});
// Start the server
const port = 3000;
app.listen(port, () => {