diff --git a/index.js b/index.js index e967023..33886e5 100644 --- a/index.js +++ b/index.js @@ -3,22 +3,28 @@ const express = require('express'); const app = express(); require('dotenv').config() const cron = require('node-cron') +const ical = require('node-ical'); -app.get('/send-target-reports', (req, res) => { - console.log('Sending target reports to sales executives'); - res.send('Target reports sent successfully'); +app.get('/get', async (req, res) => { + // console.log('Sending target reports to sales executives'); + res.send( await cc() ); + }); - app.listen(3000, () => { console.log('Server is running on port 3000'); }); -console.log('hhhh', process.env.FOO); +let cc = async () => { + return await ical.async.fromURL('https://calendar.google.com/calendar/ical/8535432843cb4e2c6776816cd5097db0365c4e3d7b1e3562ad3e123594966f49%40group.calendar.google.com/private-b917decbb793a04fccd77d1c371aadab/basic.ics', + function(err, data) { + console.log('VVVVVVVVVVVVVVV', data); + }) +} -cron.schedule('* * * * *', () => { +cron.schedule('* * * * *', async () => { + await cc() fetchCalendar() - })