Skip to content

Commit

Permalink
feat: read data from backend
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf committed Jul 25, 2024
1 parent 850db2d commit 59a6b12
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import Image from "next/image";

export default function Home() {
export default async function Home() {
let json;

const url = process.env.BACKEND_URI;
if (!url) {
json = { error: "BACKEND_URI is not set" };
} else {
try {
const resp = await fetch(url, {});
json = await resp.json();
} catch (e: any) {
json = { error: e.message };
}
}

return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
Expand Down Expand Up @@ -38,6 +52,7 @@ export default function Home() {
priority
/>
</div>
<div className="bg-gray-200">{JSON.stringify(json)}</div>

<div className="mb-32 grid text-center lg:mb-0 lg:w-full lg:max-w-5xl lg:grid-cols-4 lg:text-left">
<a
Expand Down

0 comments on commit 59a6b12

Please sign in to comment.