Documentation ¶
Index ¶
- type App
- func (app *App) Config() *Config
- func (app *App) Delete(pattern string, handler HandlerFunc)
- func (app *App) Get(pattern string, handler HandlerFunc)
- func (app *App) Patch(pattern string, handler HandlerFunc)
- func (app *App) Post(pattern string, handler HandlerFunc)
- func (app *App) Put(pattern string, handler HandlerFunc)
- func (app *App) Run()
- func (app *App) ServeHTTP(res http.ResponseWriter, req *http.Request)
- func (app *App) Use(h ...HandlerFunc)
- type Config
- type Context
- func (ctx *Context) AddHeader(key, value string)
- func (ctx *Context) ContentType(contentType string)
- func (ctx *Context) GetHeader(key string) string
- func (ctx *Context) Json(data interface{})
- func (ctx *Context) Query(key string, index ...int) (string, error)
- func (ctx *Context) Redirect(url string)
- func (ctx *Context) Send(body interface{})
- func (ctx *Context) SendStatus(statusCode int)
- func (ctx *Context) SetHeader(key, value string)
- func (ctx *Context) StatusCode() int
- type HandlerFunc
- type RoutePath
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) Delete ¶
func (app *App) Delete(pattern string, handler HandlerFunc)
func (*App) Get ¶
func (app *App) Get(pattern string, handler HandlerFunc)
func (*App) Patch ¶
func (app *App) Patch(pattern string, handler HandlerFunc)
func (*App) Post ¶
func (app *App) Post(pattern string, handler HandlerFunc)
func (*App) Put ¶
func (app *App) Put(pattern string, handler HandlerFunc)
func (*App) Use ¶
func (app *App) Use(h ...HandlerFunc)
type Context ¶
type Context struct { Request *http.Request Response http.ResponseWriter // The application App *App // Did we already sent the response? DidSent bool // contains filtered or unexported fields }
func NewContext ¶
NewContext creates a Golf.Context instance.
func (*Context) ContentType ¶
ContentType sets content-type string.
func (*Context) Json ¶
func (ctx *Context) Json(data interface{})
Json set json response with data and proper header.
func (*Context) Send ¶
func (ctx *Context) Send(body interface{})
Send the response immediately. Set `ctx.IsSent` to `true` to make sure that the response won't be sent twice.
func (*Context) SendStatus ¶
func (*Context) StatusCode ¶
type HandlerFunc ¶
type HandlerFunc func(ctx *Context)
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) MatchRoute ¶
Click to show internal directories.
Click to hide internal directories.