Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPRouter ¶
type HTTPRouter struct {
// contains filtered or unexported fields
}
HTTPRouter default router implementation for api2go
func (HTTPRouter) GetRouteParameter ¶
func (h HTTPRouter) GetRouteParameter(r http.Request, param string) string
GetRouteParameter implemention will extract the param the julienschmidt way
func (HTTPRouter) Handle ¶
func (h HTTPRouter) Handle(protocol, route string, handler HandlerFunc)
Handle each method like before and wrap them into julienschmidt handler func style
func (*HTTPRouter) SetRedirectTrailingSlash ¶
func (h *HTTPRouter) SetRedirectTrailingSlash(enabled bool)
SetRedirectTrailingSlash wraps this internal functionality of the julienschmidt router.
type HandlerFunc ¶
HandlerFunc must contain all params from the route in the form key,value
type Routeable ¶
type Routeable interface { // Handler should return the routers main handler, often this is the router itself Handler() http.Handler // Handle must be implemented to register api2go's default routines // to your used router. // protocol will be PATCH,OPTIONS,GET,POST,PUT // route will be the request route /items/:id where :id means dynamically filled params // handler is the handler that will answer to this specific route Handle(protocol, route string, handler HandlerFunc) }
Routeable allows drop in replacement for api2go's router by default, we are using julienschmidt/httprouter but you can use any router that has similiar features e.g. gin
Click to show internal directories.
Click to hide internal directories.