Skip to content

Commit

Permalink
Merge pull request #45 from kentibs/feat/keep-active
Browse files Browse the repository at this point in the history
feat: add keep active route
  • Loading branch information
Tibz-Dankan authored Jul 23, 2024
2 parents 036f76c + fc2d41f commit caa8050
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
startRequestMonitoringTimer,
endRequestMonitoringTimer,
} from "./controllers/monitoringController";
import { keepActiveRoutes } from "./routes/keepActive/keepActiveRoutes";

dotenv.config();

Expand All @@ -38,6 +39,7 @@ app.use("/api/v1/users", userRoutes);
app.use("/api/v1/tokens", tokenRoutes);
app.use("/api/v1/events", eventRoutes);
app.use("/api/v1/newsletter", newsLetterRoutes);
app.use("/active", keepActiveRoutes);

app.use(monitoringRoutes);
app.use(endRequestMonitoringTimer);
Expand Down
11 changes: 11 additions & 0 deletions src/controllers/keepActiveController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Request, Response, NextFunction } from "express";
import { asyncHandler } from "../utils/asyncHandler";

export const getActiveStatus = asyncHandler(
async (req: Request, res: Response, next: NextFunction) => {
res.status(200).json({
status: "success",
message: "App is active",
});
}
);
8 changes: 8 additions & 0 deletions src/routes/keepActive/keepActiveRoutes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import express from "express";
import { getActiveStatus } from "../../controllers/keepActiveController";

const router = express.Router();

router.get("/active", getActiveStatus);

export { router as keepActiveRoutes };

0 comments on commit caa8050

Please sign in to comment.