Documentation
¶
Index ¶
- Constants
- func HandleMetrics(title string, ss []string) http.Handler
- func HandleStatic(prefix, path string) http.Handler
- func HandleWithLogging(logger *Logger, next http.Handler) http.Handler
- func LevelText(level logLevel) string
- func WriteResponse(w http.ResponseWriter, code int, payload Payload)
- type Chain
- type Config
- type ContentType
- type Error
- type Logger
- type Middleware
- type Payload
- type Raw
- type Route
- type Router
- func (rm *Router) Delete(pattern string, handler http.Handler)
- func (rm *Router) Forward(oldpattern string, newpattern string)
- func (rm *Router) Get(pattern string, handler http.Handler)
- func (rm *Router) Handle(method string, pattern string, handler http.Handler)
- func (rm *Router) HandleFunc(method, pattern string, handler func(http.ResponseWriter, *http.Request))
- func (rm *Router) Len() int
- func (rm *Router) Less(i, j int) bool
- func (rm *Router) Post(pattern string, handler http.Handler)
- func (rm *Router) Put(pattern string, handler http.Handler)
- func (rm *Router) Search(x string) int
- func (rm *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (rm *Router) Static(pattern string, path string)
- func (rm *Router) Swap(i, j int)
Constants ¶
View Source
const ( LevelDebug logLevel = iota LevelInfo LevelWarn LevelError LevelFatal LevelOff )
Variables ¶
This section is empty.
Functions ¶
func HandleStatic ¶
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, code int, payload Payload)
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain acts as a list of http.Handler middlewares. It's effectively immutable.
func NewChain ¶
func NewChain(mw ...Middleware) *Chain
NewChain creates a new chain, memorizing the given list of middleware handlers. New serves no other function, middlewares are only called upon a call to Then().
func (*Chain) Append ¶
func (c *Chain) Append(mw ...Middleware) *Chain
Append extends a chain, adding the specified constructors as the last ones in the request flow.
func (*Chain) Extend ¶
Extend extends a chain by adding the specified chain as the last one in the request flow.
type ContentType ¶
type ContentType string
const ( ContentJSON ContentType = "application/json" ContentXML ContentType = "application/xml" ContentHTML ContentType = "text/html" ContentText ContentType = "text/plain" )
type Error ¶
type Middleware ¶
Middleware is a piece of middleware.
Click to show internal directories.
Click to hide internal directories.