Documentation
¶
Index ¶
- func ErrorHandler(app *App) http.Handler
- type App
- func (app *App) Any(path string, routeHandler RouteHandler) *App
- func (app *App) Delete(path string, routeHandler RouteHandler) *App
- func (app *App) Get(path string, routeHandler RouteHandler) *App
- func (app *App) HandleError(res http.ResponseWriter, req *http.Request, err error)
- func (app *App) HandleMethod(methods []string, path string, routeHandler RouteHandler) *App
- 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) Resource(path string, resource Resource) *App
- func (app *App) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (app *App) Start()
- type Context
- type Cookies
- type DefaultContext
- func (d *DefaultContext) Broker() *broker.Broker
- func (d *DefaultContext) Cookies() *Cookies
- func (d *DefaultContext) Logger() logger.Logger
- func (d *DefaultContext) Params() map[string]string
- 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 Interceptor
- type MuxHandler
- type Option
- type Options
- type Resource
- type RouteHandler
- type Session
- type TestHandlerRequestOptions
- type TestHandlerRequestResult
- func (tr *TestHandlerRequestResult) AssertBodyContains(str string)
- func (tr *TestHandlerRequestResult) AssertBodyEquals(str string)
- func (tr *TestHandlerRequestResult) AssertHeaderValue(key string, value string)
- func (tr *TestHandlerRequestResult) AssertSessionValue(key string, value string)
- func (tr *TestHandlerRequestResult) AssertStatusCode(status int)
- type ZeptoTest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶
Types ¶
type App ¶
func (*App) HandleError ¶
HandleError recovers from panics gracefully and calls
func (*App) HandleMethod ¶
func (app *App) HandleMethod(methods []string, path string, routeHandler RouteHandler) *App
type Context ¶
type Context interface { context.Context Request() *http.Request Response() http.ResponseWriter Params() map[string]string Set(string, interface{}) SetStatus(status int) Context Render(template string) error RenderJson(data interface{}) error Redirect(url string) error Logger() logger.Logger Broker() *broker.Broker Cookies() *Cookies Session() *Session }
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) Broker ¶
func (d *DefaultContext) Broker() *broker.Broker
Broker is the broker instance from zepto
func (*DefaultContext) Cookies ¶
func (d *DefaultContext) Cookies() *Cookies
Retrieve request session instance
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) 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 Interceptor ¶
type Interceptor struct {
// contains filtered or unexported fields
}
func (*Interceptor) Header ¶
func (i *Interceptor) Header() http.Header
func (*Interceptor) WriteHeader ¶
func (i *Interceptor) WriteHeader(rc int)
type MuxHandler ¶
type MuxHandler func(w http.ResponseWriter, r *http.Request)
type Option ¶
type Option func(*Options)
func SessionStore ¶
SessionStore - Set the session name
func TemplateEngine ¶
TemplateEngine - Change the template engine implementation
func WebpackEnabled ¶
type RouteHandler ¶
type TestHandlerRequestOptions ¶ added in v0.0.4
type TestHandlerRequestResult ¶ added in v0.0.4
type TestHandlerRequestResult struct { Ctx *DefaultContext Status int Header http.Header Body string // contains filtered or unexported fields }
func (*TestHandlerRequestResult) AssertBodyContains ¶ added in v0.0.4
func (tr *TestHandlerRequestResult) AssertBodyContains(str string)
func (*TestHandlerRequestResult) AssertBodyEquals ¶ added in v0.0.4
func (tr *TestHandlerRequestResult) AssertBodyEquals(str string)
func (*TestHandlerRequestResult) AssertHeaderValue ¶ added in v0.0.4
func (tr *TestHandlerRequestResult) AssertHeaderValue(key string, value string)
func (*TestHandlerRequestResult) AssertSessionValue ¶ added in v0.0.4
func (tr *TestHandlerRequestResult) AssertSessionValue(key string, value string)
func (*TestHandlerRequestResult) AssertStatusCode ¶ added in v0.0.4
func (tr *TestHandlerRequestResult) AssertStatusCode(status int)
type ZeptoTest ¶ added in v0.0.4
type ZeptoTest struct {
// contains filtered or unexported fields
}
func (*ZeptoTest) TestHandlerRequest ¶ added in v0.0.4
func (zt *ZeptoTest) TestHandlerRequest(opts TestHandlerRequestOptions) (TestHandlerRequestResult, error)