Skip to content

Commit

Permalink
feat(client): Add /health endpoint to the client app
Browse files Browse the repository at this point in the history
  • Loading branch information
alepefe committed Nov 22, 2024
1 parent 1020718 commit 0a40516
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions client/src/app/health/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { env } from "@/env.mjs";

export async function GET() {
try {
const res = await fetch(env.NEXT_PUBLIC_API_URL + "/health", {
cache: "no-cache",
});
if (res.status === 200) {
return new Response("OK", {
status: 200,
headers: { "Cache-Control": "max-age=5, must-revalidate" },
});
} else {
return new Response("KO", {
status: 503,
headers: { "Cache-Control": "max-age=5, must-revalidate" },
});
}
} catch (error) {
return new Response("KO", {
status: 503,
headers: { "Cache-Control": "max-age=5, must-revalidate" },
});
}
}

0 comments on commit 0a40516

Please sign in to comment.