Documentation
¶
Index ¶
- func LoggingMiddleware(next http.Handler) http.Handler
- type App
- type DebugRegistrar
- type DefaultRouter
- func (dr *DefaultRouter) Group(prefix string) *RouterGroup
- func (r *DefaultRouter) Handle(pattern string, handler http.Handler)
- func (dr *DefaultRouter) HandleFunc(pattern string, handlerFunc func(http.ResponseWriter, *http.Request))
- func (r *DefaultRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (dr *DefaultRouter) Use(middleware ...Middleware)
- type Endpoint
- type MetricsRegistrar
- type Middleware
- type RouteRegistrar
- type Router
- type RouterGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
App struct with middleware support
func (*App) SetupRoutes ¶
func (a *App) SetupRoutes()
func (*App) SetupServer ¶
type DebugRegistrar ¶
type DebugRegistrar struct{}
func (*DebugRegistrar) RegisterRoutes ¶
func (dr *DebugRegistrar) RegisterRoutes(router Router)
type DefaultRouter ¶
type DefaultRouter struct { // endpoints is the list of all registered endpoints Endpoints []Endpoint // contains filtered or unexported fields }
DefaultRouter
func NewDefaultRouter ¶
func NewDefaultRouter(prefix string) *DefaultRouter
NewDefaultRouter creates a new DefaultRouter with the given prefix
func (*DefaultRouter) Group ¶
func (dr *DefaultRouter) Group(prefix string) *RouterGroup
Group creates a new RouterGroup under the rootGroup with the given prefix
func (*DefaultRouter) HandleFunc ¶
func (dr *DefaultRouter) HandleFunc(pattern string, handlerFunc func(http.ResponseWriter, *http.Request))
func (*DefaultRouter) ServeHTTP ¶
func (r *DefaultRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (*DefaultRouter) Use ¶
func (dr *DefaultRouter) Use(middleware ...Middleware)
type MetricsRegistrar ¶
type MetricsRegistrar struct{}
func (*MetricsRegistrar) RegisterRoutes ¶
func (m *MetricsRegistrar) RegisterRoutes(router Router)
type RouteRegistrar ¶
type RouteRegistrar interface {
RegisterRoutes(router Router)
}
type Router ¶
type Router interface { // Handle registers a new route with the given pattern and handler on the router mux Handle(pattern string, handler http.Handler) // HandleFunc registers a new route with the given pattern and handler function on the router mux HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) // ServeHTTP would dispatch the request to the default mux ServeHTTP(w http.ResponseWriter, r *http.Request) // Use adds middleware to the default router Use(middleware ...Middleware) // Group called on the router would create a group with the given prefix //and would inherit the middleware from the router and would be added to the root group of the router Group(prefix string) *RouterGroup }
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
RouterGroup represents a group of routes with a common prefix and middleware
func (*RouterGroup) Group ¶
func (rg *RouterGroup) Group(prefix string) *RouterGroup
func (*RouterGroup) HandleFunc ¶
func (rg *RouterGroup) HandleFunc(pattern string, handlerFunc func(http.ResponseWriter, *http.Request))
func (*RouterGroup) Use ¶
func (rg *RouterGroup) Use(middleware ...Middleware)
Click to show internal directories.
Click to hide internal directories.