package http
import "maragu.dev/gomponents/http"
Package http provides adapters to render gomponents in http handlers.
Index ¶
Examples ¶
Functions ¶
func Adapt ¶
func Adapt(h Handler) http.HandlerFunc
Adapt a Handler to a http.HandlerFunc. The returned g.Node is rendered to the http.ResponseWriter, in both normal and error cases. If the Handler returns an error, and it implements a "StatusCode() int" method, that HTTP status code is sent in the response header. Otherwise, the status code http.StatusInternalServerError (500) is used.
Types ¶
type Handler ¶
Handler is like http.Handler but returns a g.Node and an error. See Adapt for how errors are translated to HTTP responses.
Source Files ¶
handler.go
- Version
- v1.0.0 (latest)
- Published
- Oct 11, 2024
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 1 month ago –
Tools for package owners.