Skip to content

Commit 31fdf50

Browse files
committed
feat: api health checker 추가
1 parent 04886ce commit 31fdf50

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ import createError from "http-errors";
66
import { HTTP_STATUS, MESSAGES } from "./config/constants.js";
77
import env from "./config/env.js";
88
import editRoutes from "./routes/editRoutes.js";
9+
import healthRoutes from "./routes/healthRoutes.js";
910
import videoRoutes from "./routes/videoRoutes.js";
1011

1112
const app = express();
13+
1214
app.use("/images", express.static("public/images"));
1315
app.use(cors());
1416
app.use(express.json());
1517
app.use(express.urlencoded({ extended: true }));
1618

19+
app.use(`${env.API_PREFIX}/`, healthRoutes);
1720
app.use(`${env.API_PREFIX}/video`, videoRoutes);
1821
app.use(`${env.API_PREFIX}/edit`, editRoutes);
1922

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { HTTP_STATUS } from "../config/constants.js";
2+
3+
const healthController = (req, res) => {
4+
res.status(HTTP_STATUS.OK).json({
5+
OK: "healthCheck",
6+
});
7+
};
8+
9+
export default healthController;

src/routes/healthRoutes.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import express from "express";
2+
3+
import healthController from "../controllers/healthController.js";
4+
5+
const router = express.Router();
6+
7+
router.get("/", healthController);
8+
9+
export default router;

0 commit comments

Comments
 (0)