Documentation
¶
Index ¶
- Constants
- func InitLogger(logger GeeLogger)
- func MakeRouterKey(method string, pattern string) string
- func PanicInvalidPattern(pattern string)
- type Context
- func (c *Context) Data(code int, data []byte)
- func (c *Context) Fail(code int, err error)
- func (c *Context) HTML(code int, name string, data any)
- func (c *Context) Json(code int, obj any)
- 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(k, v string)
- func (c *Context) Status(code int)
- func (c *Context) String(code int, format string, values ...any)
- type Engine
- func (e *Engine) GET(pattern string, handler HandlerFunc)
- func (e *Engine) LoadHTMLGlob(pattern string)
- func (e *Engine) POST(pattern string, handler HandlerFunc)
- func (e *Engine) Run(addr string) error
- func (e *Engine) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (e *Engine) SetHtmlFuncMap(funcMap template.FuncMap)
- type GeeLogger
- type H
- type HandlerFunc
- type RouterGroup
Constants ¶
View Source
const ParamFilePath = "filepath"
Variables ¶
This section is empty.
Functions ¶
func InitLogger ¶
func InitLogger(logger GeeLogger)
func MakeRouterKey ¶
func PanicInvalidPattern ¶
func PanicInvalidPattern(pattern string)
Types ¶
type Context ¶
type Engine ¶
type Engine struct { *RouterGroup // contains filtered or unexported fields }
func (*Engine) GET ¶
func (e *Engine) GET(pattern string, handler HandlerFunc)
GET defines the method to add GET request
func (*Engine) LoadHTMLGlob ¶
func (*Engine) POST ¶
func (e *Engine) POST(pattern string, handler HandlerFunc)
POST defines the method to add POST request
func (*Engine) SetHtmlFuncMap ¶
type HandlerFunc ¶
type HandlerFunc func(ctx *Context)
func Logger ¶
func Logger() HandlerFunc
func Recovery ¶
func Recovery() HandlerFunc
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
func (*RouterGroup) GET ¶
func (g *RouterGroup) GET(pattern string, handler HandlerFunc)
GET defines the method to add GET request
func (*RouterGroup) Group ¶
func (g *RouterGroup) Group(prefix string) *RouterGroup
func (*RouterGroup) POST ¶
func (g *RouterGroup) POST(pattern string, handler HandlerFunc)
POST defines the method to add POST request
func (*RouterGroup) Static ¶
func (g *RouterGroup) Static(pattern string, root string)
serve static files pattern 为请求该文件夹req路径 root 为磁盘上的某个文件夹
func (*RouterGroup) Use ¶
func (g *RouterGroup) Use(middlewares ...HandlerFunc)
Use is defined to add middleware to the group
Click to show internal directories.
Click to hide internal directories.