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 ActionInfo
- type LayoutParams
- type PageParams
- type RouteInfo
- type RouteParams
Constants ¶
This section is empty.
Variables ¶
var Actions = []ActionInfo{ {Pattern: "POST /_action/00369cf962b6/Rename", Path: "/_action/00369cf962b6/Rename", Dir: "users/id_", Handler: "Rename", Hash: "00369cf962b6", Published: "rename", Typed: false}, {Pattern: "POST /_action/d71506d06c1e/Retire", Path: "/_action/d71506d06c1e/Retire", Dir: "users/id_", Handler: "Retire", Hash: "d71506d06c1e", Published: "retire", Typed: false}, }
Actions lists every server function endpoint. Every exported handler in a route package is reachable whether or not a template references it, so this is what makes that surface inspectable.
An endpoint grants nothing: the path hides structure but is not a capability token, so each handler still authenticates and authorizes its own caller.
var Routes = []RouteInfo{ {Pattern: "GET /{$}", Path: "/", Dir: "", Params: nil}, {Pattern: "GET /about", Path: "/about", Dir: "about", Params: nil}, {Pattern: "GET /archive", Path: "/archive", Dir: "archive", Params: nil}, {Pattern: "GET /records/{id}", Path: "/records/{id}", Dir: "records/id_", Params: []string{"id"}}, {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.
Pattern is spelled for the router these routes are registered on, while Path is the address the filesystem declared. They differ only where the router spells a segment differently than net/http does.
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 router carrying every discovered route.
func Page ¶
func Page(params PageParams) htmlbind.Fragment
Page binds Page to its parameters, producing a renderable fragment.
Types ¶
type ActionInfo ¶ added in v0.2.3
type ActionInfo struct {
// Pattern is the stdlib ServeMux pattern the endpoint is registered under.
Pattern string
// Path is the pattern without its method.
Path string
// Dir is the declaring package's directory relative to the route root.
Dir string
// Handler is the exported Go function name.
Handler string
// Hash is the stable half of the path.
Hash string
// Published is the identifier client script calls this action through, and
// Typed reports that a declaration admitted it rather than its signature.
// A typed action is reached only by a call; no template can name one.
Published string
Typed bool
}
ActionInfo is one entry of Actions.
type LayoutParams ¶
type PageParams ¶
type PageParams struct{}
type RouteInfo ¶
type RouteInfo struct {
// Pattern is what the route is registered under, spelled for the router.
Pattern string
// Path is the address the filesystem declared, in net/http spelling. It is
// the one to build a sitemap from, because a router's own spelling of a
// catch-all is not a URL.
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.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package archive is the route that needs the request itself rather than the address it was sent to.
|
Package archive is the route that needs the request itself rather than the address it was sent to. |
|
records
|
|
|
id_
Package id_ serves one record with no typed entry point.
|
Package id_ serves one record with no typed entry point. |
|
users
|
|