Skip to content

Commit

Permalink
move health check to router
Browse files Browse the repository at this point in the history
  • Loading branch information
RbAvci committed May 9, 2024
1 parent b785775 commit 3177b87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 4 additions & 0 deletions server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ router.get("/videos", async (_, res) => {
res.json(result.rows[0]);
});

router.get("/health", async (_, res) => {
res.sendStatus(200);
});

export default router;
3 changes: 0 additions & 3 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ app.use(express.json());
// api calls are all under /api and are handled in api.js
app.use("/api", apiRouter);

// health-check call will help during deployment determine if the system has been deployed successfully
app.use("/api/health", (_, res) => res.sendStatus(200));

// everything that is not an API call is likely the frontend react app, so make sure we route the frontend app there.
// This will allow us to access the React frontend on the same link as the backend.
const __dirname = path.dirname(fileURLToPath(import.meta.url));
Expand Down

0 comments on commit 3177b87

Please sign in to comment.