export async function getServerSideProps() { const goApiUrl = process.env.GO_API_URL || 'http://localhost:8080' let notes = [] let error = null try { const res = await fetch(`${goApiUrl}/api/notes`) notes = await res.json() } catch (err) { error = err.message } return { props: { notes, error, fetchedAt: new Date().toISOString(), goApiUrl, }, } } export default function Home({ notes, error, fetchedAt, goApiUrl }) { return (

DeBros Notes (SSR)

Next.js SSR + Go API + SQLite

Server-side fetched at: {fetchedAt} from {goApiUrl}

{error &&

Error: {error}

} {notes.length === 0 ? (

No notes yet. Add some via the Go API or React app.

) : ( notes.map((n) => (
{n.title}

{n.content}

{n.created_at}
)) )}

This page is server-side rendered on every request. Refresh to see new notes added from other apps.

) }