Skip to content

Commit

Permalink
Merge pull request #705 from elitenoire/fix/add-hng-test-route-for-ba…
Browse files Browse the repository at this point in the history
…ckends

Fix/add hng test route for backends
  • Loading branch information
Prudent Bird authored Jul 28, 2024
2 parents 7ba3479 + 678d0d6 commit 7eadbb8
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/app/(landing-routes)/hng-test/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { env } from "~/env";

export default async function HNGTEST() {
const response = await fetch(`${env.NEXT_PUBLIC_BACKEND_PROBE_URL}`, {
cache: "no-store",
});
const result = response.ok ? await response.json() : {};

let result = {} as { message?: string };
try {
if (process.env.NEXT_PUBLIC_BACKEND_PROBE_URL) {
const response = await fetch(
`${process.env.NEXT_PUBLIC_BACKEND_PROBE_URL}`,
{
cache: "no-store",
},
);
result = response.ok ? await response.json() : {};
}
} catch {
result = {};
}
return (
<div className="flex items-center justify-center py-10">
<div className="space-y-2">
<h1 className="text-2xl font-semibold lg:text-3xl">HNG TEST BACKEND</h1>
<p>Version 0.12</p>
<p>{env.NEXT_PUBLIC_BACKEND_PROBE_URL}</p>
<p>{process.env.NEXT_PUBLIC_BACKEND_PROBE_URL || ""}</p>
<p>{result?.message}</p>
</div>
</div>
Expand Down

0 comments on commit 7eadbb8

Please sign in to comment.