diff --git a/src/app/page.tsx b/src/app/page.tsx index 1d88f1c..66c27a8 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,16 +1,52 @@ +import DbStatus from "@/components/DbStatus"; + export default function Home() { return ( -
-

jskim.vexplor.com

-

- Next.js + PostgreSQL 프로젝트가 준비되었습니다. -

- - DB 연결 상태 확인 → /api/health - -
+
+ {/* 헤더 */} +
+
+ jskim + +
+
+ + {/* 메인 */} +
+
+

메인 페이지

+

+ jskim.vexplor.com — Next.js + PostgreSQL 기본 틀 +

+
+ +
+
+ + {/* 콘텐츠 카드 자리 */} +
+ {["섹션 A", "섹션 B", "섹션 C"].map((title) => ( +
+

{title}

+

+ 콘텐츠가 들어갈 자리입니다. +

+
+ ))} +
+
+ + {/* 푸터 */} + +
); } diff --git a/src/components/DbStatus.tsx b/src/components/DbStatus.tsx new file mode 100644 index 0000000..75fe6a0 --- /dev/null +++ b/src/components/DbStatus.tsx @@ -0,0 +1,33 @@ +"use client"; + +import { useEffect, useState } from "react"; + +type Health = { + status: string; + db: { connected: boolean; now?: string; version?: string }; +}; + +export default function DbStatus() { + const [health, setHealth] = useState(null); + const [error, setError] = useState(false); + + useEffect(() => { + fetch("/api/health") + .then((res) => res.json()) + .then(setHealth) + .catch(() => setError(true)); + }, []); + + if (error) + return ● API 응답 없음; + if (!health) + return ● 확인 중…; + + return health.db.connected ? ( + + ● DB 연결됨 (PostgreSQL) + + ) : ( + ● DB 연결 안 됨 + ); +}