Documentation ¶
Index ¶
- Constants
- Variables
- type Binder
- type Context
- type Echo
- func (e *Echo) Any(path string, handler Handler, middleware ...Middleware)
- func (e *Echo) Connect(path string, h Handler, m ...Middleware)
- func (e *Echo) Debug() bool
- func (e *Echo) DefaultHTTPErrorHandler(err error, c Context)
- func (e *Echo) Delete(path string, h Handler, m ...Middleware)
- func (e *Echo) Get(path string, h Handler, m ...Middleware)
- func (e *Echo) Group(prefix string, m ...Middleware) (g *Group)
- func (e *Echo) Head(path string, h Handler, m ...Middleware)
- func (e *Echo) Logger() *log.Logger
- func (e *Echo) Match(methods []string, path string, handler Handler, middleware ...Middleware)
- func (e *Echo) Options(path string, h Handler, m ...Middleware)
- func (e *Echo) Patch(path string, h Handler, m ...Middleware)
- func (e *Echo) Post(path string, h Handler, m ...Middleware)
- func (e *Echo) Put(path string, h Handler, m ...Middleware)
- func (e *Echo) Router() *Router
- func (e *Echo) Routes() []Route
- func (e *Echo) Run(eng engine.Engine)
- func (e *Echo) ServeHTTP(req engine.Request, res engine.Response)
- func (e *Echo) SetBinder(b Binder)
- func (e *Echo) SetDebug(on bool)
- func (e *Echo) SetHTTPErrorHandler(h HTTPErrorHandler)
- func (e *Echo) SetLogLevel(l log.Level)
- func (e *Echo) SetLogOutput(w io.Writer)
- func (e *Echo) SetLogPrefix(prefix string)
- func (e *Echo) SetRenderer(r Renderer)
- func (e *Echo) Trace(path string, h Handler, m ...Middleware)
- func (e *Echo) URI(handler Handler, params ...interface{}) string
- func (e *Echo) URL(h Handler, params ...interface{}) string
- func (e *Echo) Use(middleware ...Middleware)
- type Group
- func (g *Group) Any(path string, handler Handler, middleware ...Middleware)
- func (g *Group) Connect(path string, h Handler, m ...Middleware)
- func (g *Group) Delete(path string, h Handler, m ...Middleware)
- func (g *Group) Get(path string, h Handler, m ...Middleware)
- func (g *Group) Group(prefix string, m ...Middleware) *Group
- func (g *Group) Head(path string, h Handler, m ...Middleware)
- func (g *Group) Match(methods []string, path string, handler Handler, middleware ...Middleware)
- func (g *Group) Options(path string, h Handler, m ...Middleware)
- func (g *Group) Patch(path string, h Handler, m ...Middleware)
- func (g *Group) Post(path string, h Handler, m ...Middleware)
- func (g *Group) Put(path string, h Handler, m ...Middleware)
- func (g *Group) Trace(path string, h Handler, m ...Middleware)
- func (g *Group) Use(m ...Middleware)
- type HTTPError
- type HTTPErrorHandler
- type Handler
- type HandlerFunc
- type Middleware
- type MiddlewareFunc
- type Renderer
- type Route
- type Router
- type Validator
Constants ¶
const ( // CONNECT HTTP method CONNECT = "CONNECT" // DELETE HTTP method DELETE = "DELETE" // GET HTTP method GET = "GET" // HEAD HTTP method HEAD = "HEAD" // OPTIONS HTTP method OPTIONS = "OPTIONS" // PATCH HTTP method PATCH = "PATCH" // POST HTTP method POST = "POST" // PUT HTTP method PUT = "PUT" // TRACE HTTP method TRACE = "TRACE" ApplicationJSON = "application/json" ApplicationJSONCharsetUTF8 = ApplicationJSON + "; " + CharsetUTF8 ApplicationJavaScript = "application/javascript" ApplicationJavaScriptCharsetUTF8 = ApplicationJavaScript + "; " + CharsetUTF8 ApplicationXML = "application/xml" ApplicationXMLCharsetUTF8 = ApplicationXML + "; " + CharsetUTF8 ApplicationForm = "application/x-www-form-urlencoded" ApplicationProtobuf = "application/protobuf" ApplicationMsgpack = "application/msgpack" TextHTML = "text/html" TextHTMLCharsetUTF8 = TextHTML + "; " + CharsetUTF8 TextPlain = "text/plain" TextPlainCharsetUTF8 = TextPlain + "; " + CharsetUTF8 MultipartForm = "multipart/form-data" OctetStream = "application/octet-stream" CharsetUTF8 = "charset=utf-8" AcceptEncoding = "Accept-Encoding" Authorization = "Authorization" ContentDisposition = "Content-Disposition" ContentEncoding = "Content-Encoding" ContentLength = "Content-Length" ContentType = "Content-Type" Location = "Location" Upgrade = "Upgrade" Vary = "Vary" WWWAuthenticate = "WWW-Authenticate" XForwardedFor = "X-Forwarded-For" XRealIP = "X-Real-IP" )
Variables ¶
var ( ErrUnsupportedMediaType = NewHTTPError(http.StatusUnsupportedMediaType) ErrNotFound = NewHTTPError(http.StatusNotFound) ErrRendererNotRegistered = errors.New("renderer not registered") ErrInvalidRedirectCode = errors.New("invalid redirect status code") )
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface { netContext.Context Request() engine.Request Response() engine.Response Path() string P(int) string Param(string) string ParamNames() []string Query(string) string Form(string) string Set(string, interface{}) Get(string) interface{} Bind(interface{}) error Render(int, string, interface{}) error HTML(int, string) error String(int, string) error JSON(int, interface{}) error JSONBlob(int, []byte) error JSONP(int, string, interface{}) error XML(int, interface{}) error XMLBlob(int, []byte) error Attachment(string) error NoContent(int) error Redirect(int, string) error Error(err error) Handle(Context) error Logger() *log.Logger Echo() *Echo Object() *context }
Context represents context for the current request. It holds request and response objects, path parameters, data and registered handler.
type Echo ¶
type Echo struct {
// contains filtered or unexported fields
}
func (*Echo) Any ¶ added in v1.2.0
func (e *Echo) Any(path string, handler Handler, middleware ...Middleware)
Any adds a route > handler to the router for all HTTP methods.
func (*Echo) Connect ¶
func (e *Echo) Connect(path string, h Handler, m ...Middleware)
Connect adds a CONNECT route > handler to the router.
func (*Echo) DefaultHTTPErrorHandler ¶ added in v1.0.0
DefaultHTTPErrorHandler invokes the default HTTP error handler.
func (*Echo) Delete ¶
func (e *Echo) Delete(path string, h Handler, m ...Middleware)
Delete adds a DELETE route > handler to the router.
func (*Echo) Get ¶
func (e *Echo) Get(path string, h Handler, m ...Middleware)
Get adds a GET route > handler to the router.
func (*Echo) Group ¶ added in v0.0.4
func (e *Echo) Group(prefix string, m ...Middleware) (g *Group)
Group creates a new sub-router with prefix.
func (*Echo) Head ¶
func (e *Echo) Head(path string, h Handler, m ...Middleware)
Head adds a HEAD route > handler to the router.
func (*Echo) Match ¶ added in v1.2.0
func (e *Echo) Match(methods []string, path string, handler Handler, middleware ...Middleware)
Match adds a route > handler to the router for multiple HTTP methods provided.
func (*Echo) Options ¶
func (e *Echo) Options(path string, h Handler, m ...Middleware)
Options adds an OPTIONS route > handler to the router.
func (*Echo) Patch ¶
func (e *Echo) Patch(path string, h Handler, m ...Middleware)
Patch adds a PATCH route > handler to the router.
func (*Echo) Post ¶
func (e *Echo) Post(path string, h Handler, m ...Middleware)
Post adds a POST route > handler to the router.
func (*Echo) Put ¶
func (e *Echo) Put(path string, h Handler, m ...Middleware)
Put adds a PUT route > handler to the router.
func (*Echo) SetBinder ¶ added in v0.0.14
SetBinder registers a custom binder. It's invoked by Context.Bind().
func (*Echo) SetHTTPErrorHandler ¶ added in v0.0.14
func (e *Echo) SetHTTPErrorHandler(h HTTPErrorHandler)
SetHTTPErrorHandler registers a custom Echo.HTTPErrorHandler.
func (*Echo) SetLogLevel ¶
SetLogLevel sets the log level for the logger. Default value is `log.FATAL`.
func (*Echo) SetLogOutput ¶
SetLogOutput sets the output destination for the logger. Default value is `os.Std*`
func (*Echo) SetLogPrefix ¶
SetLogPrefix sets the prefix for the logger. Default value is `echo`.
func (*Echo) SetRenderer ¶ added in v0.0.14
SetRenderer registers an HTML template renderer. It's invoked by Context.Render().
func (*Echo) Trace ¶
func (e *Echo) Trace(path string, h Handler, m ...Middleware)
Trace adds a TRACE route > handler to the router.
func (*Echo) Use ¶
func (e *Echo) Use(middleware ...Middleware)
Use adds handler to the middleware chain.
type Group ¶ added in v0.0.16
type Group struct {
// contains filtered or unexported fields
}
func (*Group) Connect ¶ added in v0.0.16
func (g *Group) Connect(path string, h Handler, m ...Middleware)
func (*Group) Delete ¶ added in v0.0.16
func (g *Group) Delete(path string, h Handler, m ...Middleware)
func (*Group) Match ¶
func (g *Group) Match(methods []string, path string, handler Handler, middleware ...Middleware)
func (*Group) Options ¶ added in v0.0.16
func (g *Group) Options(path string, h Handler, m ...Middleware)
func (*Group) Patch ¶ added in v0.0.16
func (g *Group) Patch(path string, h Handler, m ...Middleware)
func (*Group) Trace ¶ added in v0.0.16
func (g *Group) Trace(path string, h Handler, m ...Middleware)
func (*Group) Use ¶ added in v0.0.16
func (g *Group) Use(m ...Middleware)
type HTTPError ¶ added in v0.0.12
type HTTPError struct {
// contains filtered or unexported fields
}
func NewHTTPError ¶ added in v0.0.14
type HTTPErrorHandler ¶ added in v0.0.10
HTTPErrorHandler is a centralized HTTP error handler.
type HandlerFunc ¶
func (HandlerFunc) Handle ¶
func (h HandlerFunc) Handle(c Context) error
type Middleware ¶
type MiddlewareFunc ¶
func WrapMiddleware ¶
func WrapMiddleware(h Handler) MiddlewareFunc
WrapMiddleware wrap `echo.Handler` into `echo.MiddlewareFunc`.
func (MiddlewareFunc) Handle ¶
func (m MiddlewareFunc) Handle(h Handler) Handler