Documentation ¶
Index ¶
- Constants
- Variables
- type Context
- func (c *Context) Data(code int, data []byte)
- func (c *Context) Fail(code int, err string)
- func (c *Context) HTML(code int, name string, data interface{})
- func (c *Context) JSON(code int, obj interface{})
- func (c *Context) Next()
- func (c *Context) Param(key string) string
- func (c *Context) PostForm(key string) string
- func (c *Context) Query(key string) string
- func (c *Context) SetHeader(key string, value string)
- func (c *Context) Status(code int)
- func (c *Context) Text(code int, format string, values ...interface{})
- type Engine
- type H
- type HandlerFunc
- type RouterGroup
- func (group *RouterGroup) GET(pattern string, handler HandlerFunc)
- func (group *RouterGroup) Group(prefix string) *RouterGroup
- func (group *RouterGroup) POST(pattern string, handler HandlerFunc)
- func (group *RouterGroup) Static(relativePath string, root string)
- func (group *RouterGroup) Use(middlewares ...HandlerFunc)
Constants ¶
View Source
const Version = 1.0
Version 版本号
Variables ¶
View Source
var ZoomLogger *log.Logger
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { // origin objects Writer http.ResponseWriter Req *http.Request // request info Path string Method string Params map[string]string // response info StatusCode int // contains filtered or unexported fields }
func (*Context) HTML ¶
HTML 模版渲染器 refer https://golang.org/pkg/html/template/
type Engine ¶
type Engine struct { *RouterGroup // contains filtered or unexported fields }
Engine 实现ServeHTTP接口
func (*Engine) LoadHTMLGlob ¶
func (*Engine) ServeHTTP ¶
func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (*Engine) SetFuncMap ¶
SetFuncMap 自定义html渲染器
type HandlerFunc ¶
type HandlerFunc func(*Context)
HandlerFunc 定义zoom的请求处理器
func Logging ¶
func Logging() HandlerFunc
func Recovery ¶
func Recovery() HandlerFunc
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
Engine 实现ServeHTTP接口
func (*RouterGroup) GET ¶
func (group *RouterGroup) GET(pattern string, handler HandlerFunc)
GET Get请求
func (*RouterGroup) Group ¶
func (group *RouterGroup) Group(prefix string) *RouterGroup
Group 创造一个全新的 RouterGroup
func (*RouterGroup) POST ¶
func (group *RouterGroup) POST(pattern string, handler HandlerFunc)
POST Post请求
func (*RouterGroup) Static ¶
func (group *RouterGroup) Static(relativePath string, root string)
Static 所有的静态文件
func (*RouterGroup) Use ¶
func (group *RouterGroup) Use(middlewares ...HandlerFunc)
Use 将中间件加入到 groups
Click to show internal directories.
Click to hide internal directories.