master
omidshj 2024-09-20 21:13:24 +03:30
parent a24bb293ee
commit 66b469535c
1 changed files with 13 additions and 7 deletions

View File

@ -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()
})