Documentation ¶
Index ¶
- func Params(req *http.Request) httprouter.Params
- type Middleware
- type Mini
- func (m *Mini) DELETE(path string, handler http.HandlerFunc, middleware ...Middleware)
- func (m *Mini) GET(path string, handler http.HandlerFunc, middleware ...Middleware)
- func (m *Mini) Handle(method, path string, handler http.Handler, middleware ...Middleware)
- func (m *Mini) HandleFunc(method, path string, handler http.HandlerFunc, middleware ...Middleware)
- func (m *Mini) OPTIONS(path string, handler http.HandlerFunc, middleware ...Middleware)
- func (m *Mini) PATCH(path string, handler http.HandlerFunc, middleware ...Middleware)
- func (m *Mini) POST(path string, handler http.HandlerFunc, middleware ...Middleware)
- func (m *Mini) PUT(path string, handler http.HandlerFunc, middleware ...Middleware)
- func (m *Mini) Router() *httprouter.Router
- func (m *Mini) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (m *Mini) WithBasePath(path string) *Mini
- func (m *Mini) WithHandlerMiddleware(handler http.Handler) *Mini
- func (m *Mini) WithMiddleware(middleware ...Middleware) *Mini
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Middleware ¶
Middleware wraps an http.Handler, returning a new http.Handler.
type Mini ¶
type Mini struct {
// contains filtered or unexported fields
}
Mini adds middlewares on top of httprouter.Router
func (*Mini) DELETE ¶
func (m *Mini) DELETE(path string, handler http.HandlerFunc, middleware ...Middleware)
DELETE registers a DELETE func handler for the given path.
func (*Mini) GET ¶
func (m *Mini) GET(path string, handler http.HandlerFunc, middleware ...Middleware)
GET registers a GET func handler for the given path.
func (*Mini) Handle ¶
func (m *Mini) Handle(method, path string, handler http.Handler, middleware ...Middleware)
Handle registers a handler for the given method and path.
func (*Mini) HandleFunc ¶
func (m *Mini) HandleFunc(method, path string, handler http.HandlerFunc, middleware ...Middleware)
HandleFunc registers a func handler for the given method and path.
func (*Mini) OPTIONS ¶
func (m *Mini) OPTIONS(path string, handler http.HandlerFunc, middleware ...Middleware)
OPTIONS registers a OPTIONS func handler for the given path.
func (*Mini) PATCH ¶
func (m *Mini) PATCH(path string, handler http.HandlerFunc, middleware ...Middleware)
PATCH registers a PATCH func handler for the given path.
func (*Mini) POST ¶
func (m *Mini) POST(path string, handler http.HandlerFunc, middleware ...Middleware)
POST registers a POST func handler for the given path.
func (*Mini) PUT ¶
func (m *Mini) PUT(path string, handler http.HandlerFunc, middleware ...Middleware)
PUT registers a PUT func handler for the given path.
func (*Mini) Router ¶
func (m *Mini) Router() *httprouter.Router
Router returns the internal httprouter.Router
func (*Mini) ServeHTTP ¶
func (m *Mini) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP makes Mini implement the http.Handler interface.
func (*Mini) WithBasePath ¶
WithBasePath returns a a copy of parent with an augmented base-path, in which a set of sub-routes can be defined. It can be used for inner routes that share a common base-path. The new base-path is the concatenation of the parent's base-path and the given path (eg. <parent's base-path>/<path>).
func (*Mini) WithHandlerMiddleware ¶
WithHandlerMiddleware returns a copy of parent with an http.Handler as a new middleware.
func (*Mini) WithMiddleware ¶
func (m *Mini) WithMiddleware(middleware ...Middleware) *Mini
WithMiddleware returns a copy of parent with one or more new middlewares. It can be used for routes that share common middlewares.