update
This commit is contained in:
27
index.js
Normal file
27
index.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const express = require("express");
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
const cron = require("node-cron");
|
||||
const axios = require("axios");
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.json("Scheduler App");
|
||||
});
|
||||
|
||||
cron.schedule("* * * * *", 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);
|
||||
}
|
||||
});
|
||||
|
||||
app.use((req, res) => {
|
||||
res.json("What are you looking for?!");
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening on port ${port}`);
|
||||
});
|
||||
Reference in New Issue
Block a user