Documentation
¶
Index ¶
- Variables
- func BindLayout(params LayoutParams) htmlbind.Wrapper
- func Layout(params LayoutParams) htmlbind.Fragment
- func NewServeMux(options ...htmlbind.Option) *http.ServeMux
- func Page(params PageParams) htmlbind.Fragment
- func Register(mux *http.ServeMux, options ...htmlbind.Option)
- type LayoutParams
- type PageParams
- type RouteInfo
- type RouteParams
Constants ¶
This section is empty.
Variables ¶
View Source
var Routes = []RouteInfo{ {Pattern: "GET /{$}", Path: "/", Dir: "", Params: nil}, {Pattern: "GET /about", Path: "/about", Dir: "about", Params: nil}, {Pattern: "GET /users/{id}", Path: "/users/{id}", Dir: "users/id_", Params: []string{"id"}}, }
Routes lists what the filesystem knows about each route, so a framework can build a sitemap or an inspector without a metadata format.
Functions ¶
func BindLayout ¶
func BindLayout(params LayoutParams) htmlbind.Wrapper
BindLayout binds Layout as a chain wrapper filling its unnamed slot.
func Layout ¶
func Layout(params LayoutParams) htmlbind.Fragment
Layout binds Layout to its parameters, producing a renderable fragment.
func NewServeMux ¶
NewServeMux returns a ServeMux carrying every discovered route.
func Page ¶
func Page(params PageParams) htmlbind.Fragment
Page binds Page to its parameters, producing a renderable fragment.
Types ¶
type LayoutParams ¶
type PageParams ¶
type PageParams struct{}
type RouteInfo ¶
type RouteInfo struct {
// Pattern is the stdlib ServeMux pattern the route is registered under.
Pattern string
// Path is the pattern without its method.
Path string
// Dir is the route directory relative to the route root.
Dir string
// Params names the dynamic segments, in route order.
Params []string
}
RouteInfo is one entry of Routes.
type RouteParams ¶
type RouteParams struct {
}
RouteParams holds the URL inputs of GET /{$}.
func DecodeRoute ¶
func DecodeRoute(r *http.Request) (RouteParams, error)
DecodeRoute reads the path and query values of GET /{$}. An unparsable value produces an error rather than a zero value.
Click to show internal directories.
Click to hide internal directories.