Documentation
¶
Index ¶
- Constants
- func NewRouter(b *Bolt) (r *router)
- type Bolt
- func (b *Bolt) Connect(path string, h Handler)
- func (b *Bolt) Delete(path string, h Handler)
- func (b *Bolt) Get(path string, h Handler)
- func (b *Bolt) Handle(method, path string, h Handler)
- func (b *Bolt) Head(path string, h Handler)
- func (b *Bolt) Index(file string)
- func (b *Bolt) InternalServerErrorHandler(h HandlerFunc)
- func (b *Bolt) MaxParam(n uint8)
- func (b *Bolt) MethodNotAllowedHandler(h HandlerFunc)
- func (b *Bolt) NotFoundHandler(h HandlerFunc)
- func (b *Bolt) Options(path string, h Handler)
- func (b *Bolt) Patch(path string, h Handler)
- func (b *Bolt) Post(path string, h Handler)
- func (b *Bolt) Put(path string, h Handler)
- func (b *Bolt) Run(addr string)
- func (b *Bolt) ServeFile(path, file string)
- func (b *Bolt) ServeHTTP(rw http.ResponseWriter, r *http.Request)
- func (b *Bolt) Static(path, root string)
- func (b *Bolt) Sub(prefix string, m ...MiddlewareFunc) *Bolt
- func (b *Bolt) Trace(path string, h Handler)
- func (b *Bolt) Use(m ...Middleware)
- type Context
- func (c *Context) Bind(i interface{}) bool
- func (c *Context) Get(key string) interface{}
- func (c *Context) JSON(n int, i interface{})
- func (c *Context) P(i uint8) string
- func (c *Context) Param(n string) string
- func (c *Context) Redirect(n int, url string)
- func (c *Context) Set(key string, val interface{})
- type Handler
- type HandlerFunc
- type Middleware
- type MiddlewareFunc
- type Params
- type Status
Constants ¶
View Source
const ( MIMEJSON = "application/json" HeaderAccept = "Accept" HeaderContentDisposition = "Content-Disposition" HeaderContentLength = "Content-Length" HeaderContentType = "Content-Type" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bolt ¶
type Bolt struct {
Router *router
// contains filtered or unexported fields
}
func (*Bolt) InternalServerErrorHandler ¶
func (b *Bolt) InternalServerErrorHandler(h HandlerFunc)
InternalServerErrorHandler sets a custom InternalServerError handler.
func (*Bolt) MaxParam ¶
MaxParam sets the max path params allowed. Default is 5, good enough for many users.
func (*Bolt) MethodNotAllowedHandler ¶
func (b *Bolt) MethodNotAllowedHandler(h HandlerFunc)
MethodNotAllowedHandler sets a custom MethodNotAllowed handler.
func (*Bolt) NotFoundHandler ¶
func (b *Bolt) NotFoundHandler(h HandlerFunc)
NotFoundHandler sets a custom NotFound handler.
type Context ¶
type Context struct {
Request *http.Request
Response *response
// contains filtered or unexported fields
}
Context represents context for the current request. It holds request and response references, path parameters, data and registered handler for the route.
type HandlerFunc ¶
type HandlerFunc func(*Context)
func (HandlerFunc) ServeHTTP ¶
func (h HandlerFunc) ServeHTTP(r http.ResponseWriter, w *http.Request)
NOP
type Middleware ¶
type Middleware interface{}
type MiddlewareFunc ¶
type MiddlewareFunc func(HandlerFunc) HandlerFunc
Click to show internal directories.
Click to hide internal directories.