Skip to content

HTMX Setup

Please, check https://htmx.org/docs/#installing for installation instructions. In addition to this, you must register HTMX handlers for your dynamic components.

go
package main

...

func main() {
	// Initialize mux
	mux := http.NewServeMux()
	// Register pages
	mux.HandleFunc("/", rendering.Handler(Page))
	// Register components
	mux.HandleFunc("/htmx/component", rendering.Handler(Component))
	// Serve
	http.ListenAndServe(":8080", mux)
}