Spaces:
Paused
Paused
| const express = require("express"); | |
| const path = require("path"); | |
| const pingerRoutes = require("./routes/pinger.routes"); | |
| const scheduler = require("./services/scheduler.service"); | |
| const app = express(); | |
| app.use(express.json()); | |
| app.set("view engine", "ejs"); | |
| app.set("views", path.join(__dirname, "views")); | |
| app.get("/", (req, res) => { | |
| res.render("index", { status: "Running ✅" }); | |
| }); | |
| // health | |
| app.get("/health", (req, res) => { | |
| res.json({ status: "OK" }); | |
| }); | |
| // routes | |
| app.use("/", pingerRoutes); | |
| // start scheduler | |
| scheduler.start(); | |
| const PORT = 8501; | |
| app.listen(PORT, () => console.log("Server running on", PORT)); |