Documentation ¶
Index ¶
- type App
- func (app *App) Any(path string, routeHandler RouteHandler) *App
- func (app *App) Configure(opts ConfigureOptions)
- func (app *App) Delete(path string, routeHandler RouteHandler) *App
- func (app *App) Get(path string, routeHandler RouteHandler) *App
- func (app *App) HandleError(router *Router, ctx Context, err error)
- func (app *App) HandleMethod(methods []string, path string, routeHandler RouteHandler) *App
- func (app *App) Init()
- func (app *App) Patch(path string, routeHandler RouteHandler) *App
- func (app *App) Post(path string, routeHandler RouteHandler) *App
- func (app *App) Put(path string, routeHandler RouteHandler) *App
- func (app *App) RendererEngine() renderer.Engine
- func (app *App) Resource(path string, resource Resource) *App
- func (app *App) Router(path string, opts ...RouterOption) *Router
- func (app *App) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (app *App) StartWebpackServer()
- func (app *App) Use(mw ...MiddlewareFunc)
- func (app *App) UsePrepend(mw ...MiddlewareFunc)
- type ConfigureOptions
- type Context
- type Cookies
- type DefaultContext
- func (d *DefaultContext) Cookies() *Cookies
- func (d *DefaultContext) DB() *gorm.DB
- func (d *DefaultContext) GetStatus() int
- func (d *DefaultContext) Logger() logger.Logger
- func (d *DefaultContext) Params() map[string]string
- func (d *DefaultContext) PluginInstance(name string) interface{}
- func (d *DefaultContext) Redirect(url string) error
- func (d *DefaultContext) Render(template string) error
- func (d *DefaultContext) RenderJson(data interface{}) error
- func (d *DefaultContext) Request() *http.Request
- func (d *DefaultContext) Response() http.ResponseWriter
- func (d *DefaultContext) Session() *Session
- func (d *DefaultContext) Set(key string, value interface{})
- func (d *DefaultContext) SetStatus(s int) Context
- func (d *DefaultContext) Value(key interface{}) interface{}
- type MiddlewareFunc
- type MiddlewareStack
- type MuxHandler
- type Options
- type Resource
- type RouteHandler
- type Router
- func (router *Router) Any(path string, routeHandler RouteHandler) *Router
- func (router *Router) Delete(path string, routeHandler RouteHandler) *Router
- func (router *Router) Get(path string, routeHandler RouteHandler) *Router
- func (router *Router) HandleMethod(methods []string, path string, routeHandler RouteHandler) *Router
- func (router *Router) Patch(path string, routeHandler RouteHandler) *Router
- func (router *Router) Post(path string, routeHandler RouteHandler) *Router
- func (router *Router) Put(path string, routeHandler RouteHandler) *Router
- func (router *Router) Resource(path string, resource Resource) *Router
- func (router *Router) Use(mw ...MiddlewareFunc)
- func (router *Router) UsePrepend(mw ...MiddlewareFunc)
- type RouterHandler
- type RouterOption
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
func (*App) Configure ¶ added in v1.0.2
func (app *App) Configure(opts ConfigureOptions)
func (*App) HandleError ¶
HandleError recovers from panics gracefully and calls
func (*App) HandleMethod ¶
func (app *App) HandleMethod(methods []string, path string, routeHandler RouteHandler) *App
func (*App) RendererEngine ¶ added in v1.0.2
func (*App) Router ¶ added in v0.0.8
func (app *App) Router(path string, opts ...RouterOption) *Router
func (*App) StartWebpackServer ¶ added in v1.0.2
func (app *App) StartWebpackServer()
func (*App) Use ¶ added in v0.0.5
func (app *App) Use(mw ...MiddlewareFunc)
func (*App) UsePrepend ¶ added in v1.0.2
func (app *App) UsePrepend(mw ...MiddlewareFunc)
type ConfigureOptions ¶ added in v1.0.2
type Context ¶
type Context interface { context.Context Request() *http.Request Response() http.ResponseWriter Params() map[string]string Set(string, interface{}) SetStatus(status int) Context GetStatus() int Render(template string) error RenderJson(data interface{}) error Redirect(url string) error Logger() logger.Logger Cookies() *Cookies Session() *Session PluginInstance(name string) interface{} DB() *gorm.DB }
type Cookies ¶
type Cookies struct {
// contains filtered or unexported fields
}
func (*Cookies) SetWithExpirationTime ¶
SetWithExpirationTime sets a cookie that will expire at a specific time.
func (*Cookies) SetWithPath ¶
SetWithPath sets a cookie path on the server in which the cookie will be available on.
type DefaultContext ¶
func NewDefaultContext ¶
func NewDefaultContext() *DefaultContext
func (*DefaultContext) Cookies ¶
func (d *DefaultContext) Cookies() *Cookies
Retrieve request session instance
func (*DefaultContext) DB ¶ added in v1.0.2
func (d *DefaultContext) DB() *gorm.DB
func (*DefaultContext) GetStatus ¶ added in v0.0.10
func (d *DefaultContext) GetStatus() int
GetStatus get the current context status
func (*DefaultContext) Logger ¶
func (d *DefaultContext) Logger() logger.Logger
Logger is the logger instance from zepto
func (*DefaultContext) Params ¶
func (d *DefaultContext) Params() map[string]string
Retrieve a map of URL parameters
func (*DefaultContext) PluginInstance ¶ added in v1.0.2
func (d *DefaultContext) PluginInstance(name string) interface{}
func (*DefaultContext) Redirect ¶ added in v0.0.2
func (d *DefaultContext) Redirect(url string) error
Redirect to url
func (*DefaultContext) Render ¶
func (d *DefaultContext) Render(template string) error
Render a template
func (*DefaultContext) RenderJson ¶
func (d *DefaultContext) RenderJson(data interface{}) error
Render a json
func (*DefaultContext) Request ¶ added in v0.0.2
func (d *DefaultContext) Request() *http.Request
Request is the http request
func (*DefaultContext) Response ¶ added in v0.0.2
func (d *DefaultContext) Response() http.ResponseWriter
Response is the http response writer
func (*DefaultContext) Session ¶
func (d *DefaultContext) Session() *Session
Retrieve request session instance
func (*DefaultContext) Set ¶
func (d *DefaultContext) Set(key string, value interface{})
Set a value to context. The values defined here are accessible in the template
func (*DefaultContext) SetStatus ¶
func (d *DefaultContext) SetStatus(s int) Context
SetStatus set a http status code before render
func (*DefaultContext) Value ¶
func (d *DefaultContext) Value(key interface{}) interface{}
Value returns a value from context
type MiddlewareFunc ¶ added in v0.0.5
type MiddlewareFunc func(RouteHandler) RouteHandler
type MiddlewareStack ¶ added in v0.0.5
type MiddlewareStack struct {
// contains filtered or unexported fields
}
func (*MiddlewareStack) Use ¶ added in v0.0.5
func (ms *MiddlewareStack) Use(mw ...MiddlewareFunc)
func (*MiddlewareStack) UsePrepend ¶ added in v1.0.2
func (ms *MiddlewareStack) UsePrepend(mw ...MiddlewareFunc)
type MuxHandler ¶
type MuxHandler func(w http.ResponseWriter, r *http.Request)
type RouteHandler ¶
type Router ¶ added in v0.0.8
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶ added in v0.0.8
func NewRouter(path string, opts ...RouterOption) *Router
func (*Router) Any ¶ added in v0.0.8
func (router *Router) Any(path string, routeHandler RouteHandler) *Router
func (*Router) Delete ¶ added in v0.0.8
func (router *Router) Delete(path string, routeHandler RouteHandler) *Router
func (*Router) Get ¶ added in v0.0.8
func (router *Router) Get(path string, routeHandler RouteHandler) *Router
func (*Router) HandleMethod ¶ added in v0.0.8
func (router *Router) HandleMethod(methods []string, path string, routeHandler RouteHandler) *Router
func (*Router) Patch ¶ added in v0.0.8
func (router *Router) Patch(path string, routeHandler RouteHandler) *Router
func (*Router) Post ¶ added in v0.0.8
func (router *Router) Post(path string, routeHandler RouteHandler) *Router
func (*Router) Put ¶ added in v0.0.8
func (router *Router) Put(path string, routeHandler RouteHandler) *Router
func (*Router) Use ¶ added in v0.0.8
func (router *Router) Use(mw ...MiddlewareFunc)
func (*Router) UsePrepend ¶ added in v1.0.2
func (router *Router) UsePrepend(mw ...MiddlewareFunc)
type RouterHandler ¶ added in v0.0.8
type RouterHandler struct {
// contains filtered or unexported fields
}
type RouterOption ¶ added in v0.0.8
type RouterOption func(*routerOptions)
func Hosts ¶ added in v0.0.8
func Hosts(hosts ...string) RouterOption