hxbindings

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

hx-bindings

Route-aware hx-* bindings end to end: a symbol binding (hx-get={ handlers.ListItems }) folds a registered path into static markup, and a typed constructor (hx-get={ ghtmxgen.GetItem(id) }) substitutes URL-escaped parameters. Renaming either route breaks the build at the binding site.

ghtmx generate && go run ./cmd    # serves http://127.0.0.1:8081/items

One deliberate wrinkle: the handlers live in a subpackage so the templates can demonstrate a cross-package symbol binding. Because the templates bind handlers.* symbols, the handlers package cannot import the template package back — the example installs the render bodies through the handlers.ListItemsBody/GetItemBody hooks in its init. Serving the handlers without those hooks installed is a loud 500 naming the missing hook, never a healthy-looking empty response. A single-package application needs none of this plumbing; the crud example is the canonical single-package shape.

Documentation

Overview

The hx-bindings example exercises route-aware hx-* bindings end to end: a symbol binding folds a registered path into static markup, and a typed route constructor substitutes URL-escaped parameters (FR-020, FR-021, FR-023). Its test is the mandatory route-binding case of the escaping conformance suite (NFR-007).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Routes

func Routes() *http.ServeMux

Routes builds the example's router; the official docs site mounts it as a live demo.

Types

This section is empty.

Directories

Path Synopsis
Command hxbindings serves the hx-bindings example standalone.
Command hxbindings serves the hx-bindings example standalone.
Package handlers holds the hx-bindings example's HTTP handlers.
Package handlers holds the hx-bindings example's HTTP handlers.

Jump to

Keyboard shortcuts

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