Documentation ¶
Overview ¶
router package implements a http.Handler and the ability to register routes on a gateway
Index ¶
Constants ¶
View Source
const (
ScopeRead = "github.com/mutablelogic/go-server/router:read"
)
Variables ¶
This section is empty.
Functions ¶
func NewWithPlugin ¶
Create a new router task, and register routes from gateways
Types ¶
type Gateway ¶
type Gateway struct { Prefix string `json:"prefix,omitempty"` Label string `json:"label"` Description string `json:"description,omitempty"` Routes []GatewayRoute `json:"routes,omitempty"` Middleware []string `json:"middleware,omitempty"` }
type GatewayRoute ¶
type Middleware ¶ added in v1.1.5
type Middleware struct {
// contains filtered or unexported fields
}
Middleware is a handler which is called before or after the request
func (Middleware) String ¶ added in v1.1.5
func (middleware Middleware) String() string
type MiddlewareFn ¶ added in v1.1.5
type MiddlewareFn func(http.HandlerFunc) http.HandlerFunc
MiddlewareFn returns a new http.HandlerFunc given a "child" http.HandlerFunc
type Plugin ¶
type Plugin struct { task.Plugin Prefix_ types.String `json:"prefix,omitempty"` // Path for serving the router schema, optional Routes []Route `json:"routes"` // Routes to add to the router, optional (but useless without) Middleware_ []string `json:"middleware,omitempty"` // Middleware to add to the router for all routes, optional }
Plugin for the router maps prefixes to gateways
func (Plugin) Middleware ¶ added in v1.1.5
func (Plugin) WithPrefix ¶
func (Plugin) WithRoutes ¶
Click to show internal directories.
Click to hide internal directories.