Documentation
¶
Index ¶
- Constants
- func RouterHandler(router *Router) http.HandlerFunc
- type Config
- type Context
- func (c *Context) Abort()
- func (c *Context) Accepts(types ...string) string
- func (c *Context) BodyParser(v interface{}) error
- func (c *Context) ClearCookie(name string)
- func (c *Context) GetCookie(name string) string
- func (c *Context) GetRequestHeader(key string) string
- func (c *Context) GetResponseHeader(key string) string
- func (c *Context) GetValue(key string) string
- func (c *Context) JSON(code int, obj interface{}) ([]byte, error)
- func (c *Context) Next() error
- func (c *Context) Param(key string) string
- func (c *Context) Query(key string) string
- func (c *Context) Reset()
- func (c *Context) SetContentType(value string)
- func (c *Context) SetCookie(cookie *Cookie)
- func (c *Context) SetRequestHeader(key, value string)
- func (c *Context) SetResponseHeader(key, value string)
- func (c *Context) SetValue(key interface{}, value interface{})
- func (c *Context) Status(code int)
- func (c *Context) String(value string)
- func (c *Context) WithParams(params map[string]string) *Context
- func (c *Context) Write(p []byte) (n int, err error)
- type Cookie
- type Group
- func (g *Group) DELETE(path string, handlers ...Handler)
- func (g *Group) GET(path string, handlers ...Handler)
- func (g *Group) Group(prefix string) *Group
- func (g *Group) HEAD(path string, handlers ...Handler)
- func (g *Group) OPTIONS(path string, handlers ...Handler)
- func (g *Group) PATCH(path string, handlers ...Handler)
- func (g *Group) POST(path string, handlers ...Handler)
- func (g *Group) PUT(path string, handlers ...Handler)
- func (g *Group) Static(path, root string, config *Static)
- func (g *Group) Use(middleware Middleware)
- type Handler
- type HandlerFunc
- type Middleware
- type MiddlewareFunc
- type Pulse
- type Route
- type Router
- func (r *Router) Add(method, path string, handlers ...Handler)
- func (r *Router) Connect(path string, handlers ...Handler)
- func (r *Router) Delete(path string, handlers ...Handler)
- func (r *Router) Find(method, path string) []Handler
- func (r *Router) Get(path string, handlers ...Handler)
- func (r *Router) Head(path string, handlers ...Handler)
- func (r *Router) Options(path string, handlers ...Handler)
- func (r *Router) Patch(path string, handlers ...Handler)
- func (r *Router) Post(path string, handlers ...Handler)
- func (r *Router) Put(path string, handlers ...Handler)
- func (r *Router) Static(prefix, root string, options *Static)
- func (r *Router) Trace(path string, handlers ...Handler)
- func (r *Router) Use(method string, middlewares ...interface{})
- type Static
Constants ¶
View Source
const ( // DefaultAppName is the default app name DefaultAppName = "Pulse" // DefaultNetwork is the default network DefaultNetwork = "tcp" )
Variables ¶
This section is empty.
Functions ¶
func RouterHandler ¶
func RouterHandler(router *Router) http.HandlerFunc
Types ¶
type Context ¶
type Context struct { ResponseWriter http.ResponseWriter Response http.Response Request *http.Request Params map[string]string Cookies []*http.Cookie // contains filtered or unexported fields }
func NewContext ¶
func NewContext(w http.ResponseWriter, req *http.Request) *Context
NewContext returns a new Context.
func (*Context) BodyParser ¶ added in v0.5.0
func (*Context) ClearCookie ¶
ClearCookie deletes the cookie with the given name.
func (*Context) GetRequestHeader ¶ added in v0.4.0
GetRequestHeader GetResponseHeader returns the http header value for the given key.
func (*Context) GetResponseHeader ¶ added in v0.4.0
GetResponseHeader returns the http header value for the given key.
func (*Context) JSON ¶ added in v0.4.0
JSON sets the response body to the given JSON representation.
func (*Context) SetContentType ¶ added in v0.4.0
SetContentType sets the Content-Type header in the response to the given value.
func (*Context) SetRequestHeader ¶ added in v0.4.0
SetRequestHeader SetResponseHeader sets the http header value to the given key.
func (*Context) SetResponseHeader ¶ added in v0.4.0
SetResponseHeader sets the http header value to the given key.
func (*Context) SetValue ¶ added in v1.0.0
func (c *Context) SetValue(key interface{}, value interface{})
SetValue create a middleware that adds a value to the context
func (*Context) WithParams ¶
WithParams sets the params for the context.
type Group ¶ added in v0.2.0
func (*Group) Use ¶ added in v0.2.0
func (g *Group) Use(middleware Middleware)
type HandlerFunc ¶ added in v1.0.0
type HandlerFunc func(w http.ResponseWriter, r *http.Request) error
type Middleware ¶
type MiddlewareFunc ¶
func CORSMiddleware ¶
func CORSMiddleware() MiddlewareFunc
func (MiddlewareFunc) Middleware ¶
func (m MiddlewareFunc) Middleware(handler Handler) Handler
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.