'use client' import { useEffect, useState } from 'react' interface ApiResponse { message: string db_status: string } export default function Home() { const [data, setData] = useState(null) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) useEffect(() => { const apiUrl = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080' fetch(`${apiUrl}/api/hello`) .then((res) => res.json()) .then((data) => { setData(data) setLoading(false) }) .catch((err) => { setError(err.message) setLoading(false) }) }, []) return (

Hello World!

Go + PostgreSQL + Next.js

{loading &&

Loading...

} {error &&

Error: {error}

} {data && ( <>

{data.message}

Database: {data.db_status}

)}
Go PostgreSQL Next.js
) } const styles: { [key: string]: React.CSSProperties } = { main: { minHeight: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center', background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', fontFamily: 'system-ui, -apple-system, sans-serif', }, container: { textAlign: 'center', color: 'white', }, title: { fontSize: '4rem', marginBottom: '0.5rem', textShadow: '2px 2px 4px rgba(0,0,0,0.2)', }, subtitle: { fontSize: '1.25rem', opacity: 0.9, marginBottom: '2rem', }, card: { background: 'rgba(255,255,255,0.95)', borderRadius: '12px', padding: '2rem', color: '#333', boxShadow: '0 10px 40px rgba(0,0,0,0.2)', marginBottom: '2rem', }, message: { fontSize: '1.25rem', fontWeight: 500, }, status: { marginTop: '1rem', fontSize: '1rem', }, error: { color: '#ef4444', }, techStack: { display: 'flex', gap: '1rem', justifyContent: 'center', }, badge: { background: 'rgba(255,255,255,0.2)', padding: '0.5rem 1rem', borderRadius: '20px', fontSize: '0.875rem', }, }