adapters-templ

command
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 19 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL