1
0
Fork 0

return the contents of the .ics file

This commit is contained in:
Ryan Mwangi 2024-10-24 15:35:03 +03:00
parent 1150778f4c
commit d1084ea558
1 changed files with 4 additions and 0 deletions

View File

@ -191,6 +191,10 @@ app.get('/calendar/:name', async (req, res) => {
return res.status(404).json({ error: 'Calendar not found.' }); return res.status(404).json({ error: 'Calendar not found.' });
} }
// Return the contents of the .ics file
res.setHeader('Content-Type', 'text/calendar');
res.sendFile(icsFilePath);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
res.status(500).json({ error: 'Failed to retrieve calendar data.' }); res.status(500).json({ error: 'Failed to retrieve calendar data.' });