Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chain ¶
func Chain(h http.Handler, ms ...Middleware) http.Handler
Chain wraps a handler with multiple middleware. The provided middleware are iterated through in reverse order. This means that the first provided middleware will be called first when a request is handled. For example, given the following function call
Chain(baseHandler, loggingMiddleware, authMiddleware)
a request would go through the loggingMiddleware, then the authMiddleware, then be handled by the base handler.
Types ¶
type AuthController ¶
func (*AuthController) Register ¶
func (c *AuthController) Register(router *httprouter.Router)
type ClientController ¶
func (*ClientController) GetClientByID ¶
func (c *ClientController) GetClientByID(w http.ResponseWriter, r *http.Request)
func (*ClientController) Register ¶
func (c *ClientController) Register(router *httprouter.Router)
func (*ClientController) RegisterClient ¶
func (c *ClientController) RegisterClient(w http.ResponseWriter, r *http.Request)
type Middleware ¶
Middleware is a function that wraps a handler with additional behavior.
type Registerer ¶
type Registerer interface {
Register(*httprouter.Router)
}
Registerer represents a type that can register its routes. Generally, this is a controller that registers all of the routes for its domain.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a wrapper around net/http.Server that allows for route registration. The server provides the standard loggingMiddleware which will be called before all requests.
func (*Server) ListenAndServe ¶
ListenAndServe begins listening for requests, and handles them using the registered handlers. This method will always return a non-nil error.
func (*Server) RegisterRoutes ¶
func (s *Server) RegisterRoutes(rs ...Registerer)
RegisterRoutes registers all of the provided routes. If a route is registered multiple times, this function will panic.
type UserController ¶
func (*UserController) GetByID ¶
func (c *UserController) GetByID(w http.ResponseWriter, r *http.Request)
func (*UserController) Register ¶
func (c *UserController) Register(router *httprouter.Router)
func (*UserController) RegisterUser ¶
func (c *UserController) RegisterUser(w http.ResponseWriter, r *http.Request)