Documentation
¶
Overview ¶
Package main demonstrates how go-codex fits into a templ-based rendering pipeline using the adapters/templ format plug-in.
The same rest.Route and handler function serve two formats:
- Accept: text/html → templ component rendered as HTML
- Accept: application/json → JSON response
Content negotiation is handled automatically by the existing nethttp adapter. The templ component receives validated ArticleProps; invalid props return HTTP 500 before the template is reached.
Components are implemented with templ.ComponentFunc — no code generation required to run this example.
Run with: go run ./examples/adapters-templ
Click to show internal directories.
Click to hide internal directories.