Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByWeight ¶ added in v0.2.0
type ByWeight []Middleware
ByWeight sorts a list of Middleware by Weight
type Factory ¶
type Factory func() Handler
Factory is a function that return a new Handler It is useful if you want to create a Handler that will carry request-scoped data.
type Func ¶
type Func func(http.ResponseWriter, *http.Request) (interface{}, error)
Func type is an adapter to allow the use of ordinary functions as HTTP handlers. If f is a function with the appropriate signature, handler.Func(f) is a Handler that calls f
type Handler ¶
type Handler interface {
Serve(http.ResponseWriter, *http.Request) (interface{}, error)
}
Handler is able to respond to a http request and return the response it wants to write and an error. You need to use a middleware to write your response if you just return your response and not write it. (see github.com/mwm-io/gapi/middleware.ResponseWriter)
type Middleware ¶
Middleware is able to wrap a given Handler to build a new one.
type MiddlewareAware ¶
type MiddlewareAware interface {
Middlewares() []Middleware
}
MiddlewareAware is a struct containing its own middlewares.
type SortableMiddleware ¶ added in v0.2.0
type SortableMiddleware interface { Middleware Weight() int }
SortableMiddleware embeds Middleware type with a Weight method in order to get sorted.
type WithMiddlewares ¶
type WithMiddlewares struct {
MiddlewareList []Middleware
}
WithMiddlewares implements the request.MiddlewareAware interface and is meant to be embedded into the final handler
func (WithMiddlewares) Middlewares ¶
func (p WithMiddlewares) Middlewares() []Middleware
Middlewares implements the request.MiddlewareAware interface