forked from ryanmwangi/CalMerger
create function to update merged calendar, and in it load the calendar data from calendars.jsonfile
This commit is contained in:
parent
4548e452ac
commit
4fd447104b
|
@ -97,7 +97,14 @@ app.listen(port, () => {
|
||||||
console.log(`Server started on port ${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
|
// Schedule a cron job to update the merged calendar every hour
|
||||||
cron.schedule('0 * * * *', () => {
|
cron.schedule('0 * * * *', () => {
|
||||||
console.log('Updating merged calendar...');
|
console.log('Updating merged calendar...');
|
||||||
|
|
Loading…
Reference in New Issue