diff --git a/index.js b/index.js index bcf447d..63a4888 100644 --- a/index.js +++ b/index.js @@ -8,27 +8,39 @@ app.get("/", (req, res) => { res.json("Scheduler App"); }); -cron.schedule("0 9 * * *", async () => { - const module = "Birthday Notification"; - try { - let res = await axios.get("http://36.66.3.44:7010/birthday-notification"); - console.log(module, "success", res.data); - } catch (error) { - console.error(module, "error", error.message); +cron.schedule( + "0 9 * * *", + async () => { + const module = "Birthday Notification"; + try { + let res = await axios.get("http://36.66.3.44:7010/birthday-notification"); + console.log(module, "success", res.data); + } catch (error) { + console.error(module, "error", error.message); + } + }, + { + timezone: "Asia/Jakarta", } -}); +); -cron.schedule("0 9 * * *", async () => { - const module = "Workanniversary"; - try { - let res = await axios.get( - "http://36.66.3.44:7010/workanniversary-notification" - ); - console.log(module, "success", res.data); - } catch (error) { - console.error(module, "error", error.message); +cron.schedule( + "1 9 * * *", + async () => { + const module = "Workanniversary"; + try { + let res = await axios.get( + "http://36.66.3.44:7010/workanniversary-notification" + ); + console.log(module, "success", res.data); + } catch (error) { + console.error(module, "error", error.message); + } + }, + { + timezone: "Asia/Jakarta", } -}); +); app.use((req, res) => { res.json("What are you looking for?!");