How Server Files Work
Learn how Barry uses index.server.go to execute Go logic before rendering pages.
How Server Files Work
Each index.server.go
is a Go file that exports a function Barry will call during a page request. It typically returns a map of data that gets injected into the page template.
Example folder structure:
routes/about/
├── index.html
└── index.server.go
When /about
is requested, Barry runs the handler from index.server.go
, passes its data into index.html
, and caches the result as static HTML.
This happens only once per route until the cache is cleared. For that, see Clearing the Cache.