Documentation ¶
Index ¶
- Constants
- type App
- type AppConfig
- type ContextProvider
- type Domain
- type Handler
- type Interceptor
- type Middleware
- type Middlewares
- type QueryParameters
- type Request
- type RequestContext
- type Response
- func (resp *Response) SetBodyBytes(b []byte)
- func (resp *Response) SetBodyJSON(v interface{}) error
- func (resp *Response) SetBodyString(s string)
- func (resp *Response) SetStatusCode(code int)
- func (resp *Response) ToHTTP() http.ResponseWriter
- func (resp *Response) WithJSON(v interface{}, statusCode int) error
- type Router
- func (r *Router) Connect(path string, h Handler)
- func (r *Router) Delete(path string, h Handler)
- func (r *Router) Get(path string, h Handler)
- func (r *Router) Head(path string, h Handler)
- func (r *Router) Method(method, path string, h Handler)
- func (r *Router) MethodNotAllowed(h Handler)
- func (r *Router) NotFound(h Handler)
- func (r *Router) Options(path string, h Handler)
- func (r *Router) Patch(path string, h Handler)
- func (r *Router) Post(path string, h Handler)
- func (r *Router) Put(path string, h Handler)
- func (r *Router) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request)
- func (r *Router) Trace(path string, h Handler)
- func (r *Router) Use(middlewares ...Middleware)
- func (r *Router) UseContext(contextProvider ContextProvider)
- func (r *Router) UseInterceptor(interceptor Interceptor)
- func (r *Router) With(middlewares ...Middleware) *Router
- func (r *Router) WithContext(contextProvider ContextProvider) *Router
- func (r *Router) WithInterceptor(interceptor Interceptor) *Router
- type RouterConfig
- type Server
Constants ¶
const ( TrailingSlashRedirect = "redirect" // Default trailing slash strategy TrailingSlashStrip = "strip" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type AppConfig ¶
type AppConfig struct {
Router RouterConfig
}
func NewAppConfig ¶
func NewAppConfig() *AppConfig
type ContextProvider ¶
type Handler ¶
type Handler func(RequestContext)
func FromHTTPHandler ¶
FromHTTP produces new Handler from http.HandlerFunc instance
func FromHTTPHandlerFunc ¶
func FromHTTPHandlerFunc(h http.HandlerFunc) Handler
FromHTTP produces new Handler from http.HandlerFunc instance
func (Handler) ToHTTP ¶
func (h Handler) ToHTTP() http.HandlerFunc
ToHTTTP adapts Handler interface to http.HandlerFunc interface
type Interceptor ¶
type Interceptor func() (before, after func(RequestContext))
type Middleware ¶
func FromHTTPMiddleware ¶
func FromHTTPMiddleware(m func(h http.Handler) http.Handler) Middleware
FromHTTPMiddleware produces new Middleware from http-based middleware
type Middlewares ¶
type Middlewares []Middleware
type QueryParameters ¶
func (QueryParameters) PeekAll ¶
func (qp QueryParameters) PeekAll(key string) []string
PeekAll values under given query parameter key. len(PeekAll()) == 0 for non-existing keys. PeekAll() == nil for non-existing keys.
type Request ¶
type Request struct { *http.Request QueryParameters QueryParameters QueryString string }
func NewRequest ¶
type RequestContext ¶
func NewRequestContext ¶
func NewRequestContext() RequestContext
type Response ¶
type Response struct {
http.ResponseWriter
}
func NewResponse ¶
func NewResponse(r http.ResponseWriter) *Response
func (*Response) SetBodyBytes ¶
func (*Response) SetBodyJSON ¶
func (*Response) SetBodyString ¶
func (*Response) SetStatusCode ¶
func (*Response) ToHTTP ¶
func (resp *Response) ToHTTP() http.ResponseWriter
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) MethodNotAllowed ¶
func (*Router) ServeHTTP ¶
func (r *Router) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request)
func (*Router) Use ¶
func (r *Router) Use(middlewares ...Middleware)
Use pushes given middleware onto router stack
func (*Router) UseContext ¶
func (r *Router) UseContext(contextProvider ContextProvider)
UseContext works like Use but provides interface for contextProvider middleware
func (*Router) UseInterceptor ¶
func (r *Router) UseInterceptor(interceptor Interceptor)
UseContext works like Use but provides interface for Interceptor middleware
func (*Router) With ¶
func (r *Router) With(middlewares ...Middleware) *Router
Use pushes inlined middleware onto router stack.
func (*Router) WithContext ¶
func (r *Router) WithContext(contextProvider ContextProvider) *Router
WithContext works like With but provides interface for contextProvider middleware
func (*Router) WithInterceptor ¶
func (r *Router) WithInterceptor(interceptor Interceptor) *Router
WithContext works like With but provides interface for Interceptor middleware
type RouterConfig ¶
type RouterConfig struct {
TrailingSlashStrategy string
}