1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-24 13:39:35 +02:00

Created Cron job to get data from external api every 15 minutes and save it to local database. Created Weather model and controller to get latest weather status

This commit is contained in:
unknown 2021-05-17 18:23:54 +02:00
parent 3fc3d07598
commit adc4aaed0f
8 changed files with 195 additions and 0 deletions

11
utils/jobs.js Normal file
View file

@ -0,0 +1,11 @@
const schedule = require('node-schedule');
const getExternalWeather = require('./getExternalWeather');
const weatherJob = schedule.scheduleJob('updateWeather', '0 */15 * * * *', async () => {
try {
await getExternalWeather();
console.log('weather updated');
} catch (err) {
console.log(err);
}
})