{"modulePath":"github.com/captaincodeman/echo","version":"v0.0.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package echo\n\n## Constants\n\n```go\nconst (\n\t// CONNECT HTTP method\n\tCONNECT = \"CONNECT\"\n\t// DELETE HTTP method\n\tDELETE = \"DELETE\"\n\t// GET HTTP method\n\tGET = \"GET\"\n\t// HEAD HTTP method\n\tHEAD = \"HEAD\"\n\t// OPTIONS HTTP method\n\tOPTIONS = \"OPTIONS\"\n\t// PATCH HTTP method\n\tPATCH = \"PATCH\"\n\t// POST HTTP method\n\tPOST = \"POST\"\n\t// PUT HTTP method\n\tPUT = \"PUT\"\n\t// TRACE HTTP method\n\tTRACE = \"TRACE\"\n\n\tApplicationJSON     = \"application/json\"\n\tApplicationProtobuf = \"application/protobuf\"\n\tApplicationMsgpack  = \"application/msgpack\"\n\tTextPlain           = \"text/plain\"\n\tTextHTML            = \"text/html\"\n\tApplicationForm     = \"application/x-www-form-urlencoded\"\n\tMultipartForm       = \"multipart/form-data\"\n\n\tAccept             = \"Accept\"\n\tAcceptEncoding     = \"Accept-Encoding\"\n\tContentDisposition = \"Content-Disposition\"\n\tContentEncoding    = \"Content-Encoding\"\n\tContentLength      = \"Content-Length\"\n\tContentType        = \"Content-Type\"\n\tAuthorization      = \"Authorization\"\n\tUpgrade            = \"Upgrade\"\n\n\tWebSocket = \"websocket\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tUnsupportedMediaType  = errors.New(\"echo ⇒ unsupported media type\")\n\tRendererNotRegistered = errors.New(\"echo ⇒ renderer not registered\")\n)\n```\n\n## Types\n\n```go\ntype BindFunc func(*http.Request, interface{}) error\n```\n\n```go\ntype Context struct {\n\t// contains filtered or unexported fields\n}\n```\nContext represents context for the current request. It holds request and response objects, path parameters, data and registered handler.\n\n```go\nfunc NewContext(req *http.Request, res *Response, e *Echo) *Context\n```\n\n```go\nfunc (c *Context) Bind(i interface{}) error\n```\nBind binds the request body into specified type v. Default binder does it based on Content-Type header.\n\n```go\nfunc (c *Context) Error(err error)\n```\nError invokes the registered HTTP error handler. Usually used by middleware.\n\n```go\nfunc (c *Context) Get(key string) interface{}\n```\nGet retrieves data from the context.\n\n```go\nfunc (c *Context) HTML(code int, html string) error\n```\nHTML sends a text/html response with status code.\n\n```go\nfunc (c *Context) JSON(code int, i interface{}) error\n```\nJSON sends an application/json response with status code.\n\n```go\nfunc (c *Context) NoContent(code int) error\n```\nNoContent sends a response with no body and a status code.\n\n```go\nfunc (c *Context) P(i uint8) (value string)\n```\nP returns path parameter by index.\n\n```go\nfunc (c *Context) Param(name string) (value string)\n```\nParam returns path parameter by name.\n\n```go\nfunc (c *Context) Redirect(code int, url string)\n```\nRedirect redirects the request using http.Redirect with status code.\n\n```go\nfunc (c *Context) Render(code int, name string, data interface{}) error\n```\nRender invokes the registered HTML template renderer and sends a text/html response with status code.\n\n```go\nfunc (c *Context) Request() *http.Request\n```\nRequest returns \\*http.Request.\n\n```go\nfunc (c *Context) Response() *Response\n```\nResponse returns \\*Response.\n\n```go\nfunc (c *Context) Set(key string, val interface{})\n```\nSet saves data in the context.\n\n```go\nfunc (c *Context) Socket() *websocket.Conn\n```\nSocket returns \\*websocket.Conn.\n\n```go\nfunc (c *Context) String(code int, s string) error\n```\nString sends a text/plain response with status code.\n\n```go\ntype Echo struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New() (e *Echo)\n```\nNew creates an Echo instance.\n\n```go\nfunc (e *Echo) Connect(path string, h Handler)\n```\nConnect adds a CONNECT route \u003e handler to the router.\n\n```go\nfunc (e *Echo) Debug() bool\n```\nDebug returns debug mode.\n\n```go\nfunc (e *Echo) Delete(path string, h Handler)\n```\nDelete adds a DELETE route \u003e handler to the router.\n\n```go\nfunc (e *Echo) Favicon(file string)\n```\nFavicon serves the default favicon - GET /favicon.ico.\n\n```go\nfunc (e *Echo) Get(path string, h Handler)\n```\nGet adds a GET route \u003e handler to the router.\n\n```go\nfunc (e *Echo) Group(prefix string, m ...Middleware) *Group\n```\nGroup creates a new sub router with prefix. It inherits all properties from the parent. Passing middleware overrides parent middleware.\n\n```go\nfunc (e *Echo) HTTP2(on bool)\n```\nHTTP2 enables HTTP2 support.\n\n```go\nfunc (e *Echo) Head(path string, h Handler)\n```\nHead adds a HEAD route \u003e handler to the router.\n\n```go\nfunc (e *Echo) Index(file string)\n```\nIndex serves index file.\n\n```go\nfunc (e *Echo) Options(path string, h Handler)\n```\nOptions adds an OPTIONS route \u003e handler to the router.\n\n```go\nfunc (e *Echo) Patch(path string, h Handler)\n```\nPatch adds a PATCH route \u003e handler to the router.\n\n```go\nfunc (e *Echo) Post(path string, h Handler)\n```\nPost adds a POST route \u003e handler to the router.\n\n```go\nfunc (e *Echo) Put(path string, h Handler)\n```\nPut adds a PUT route \u003e handler to the router.\n\n```go\nfunc (e *Echo) Router() *Router\n```\nRouter returns router.\n\n```go\nfunc (e *Echo) Run(addr string)\n```\nRun runs a server.\n\n```go\nfunc (e *Echo) RunServer(srv *http.Server)\n```\nRunServer runs a custom server.\n\n```go\nfunc (e *Echo) RunTLS(addr, certFile, keyFile string)\n```\nRunTLS runs a server with TLS configuration.\n\n```go\nfunc (e *Echo) RunTLSServer(srv *http.Server, certFile, keyFile string)\n```\nRunTLSServer runs a custom server with TLS configuration.\n\n```go\nfunc (e *Echo) ServeFile(path, file string)\n```\nServeFile serves a file.\n\n```go\nfunc (e *Echo) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\n\n```go\nfunc (e *Echo) SetBinder(b BindFunc)\n```\nSetBinder registers a custom binder. It's invoked by Context.Bind().\n\n```go\nfunc (e *Echo) SetDebug(on bool)\n```\nSetDebug sets debug mode.\n\n```go\nfunc (e *Echo) SetHTTPErrorHandler(h HTTPErrorHandler)\n```\nSetHTTPErrorHandler registers an Echo.HTTPErrorHandler.\n\n```go\nfunc (e *Echo) SetMaxParam(n uint8)\n```\nSetMaxParam sets the maximum number of path parameters allowed for the application. Default value is 5, good enough for many use cases.\n\n```go\nfunc (e *Echo) SetRenderer(r Renderer)\n```\nSetRenderer registers an HTML template renderer. It's invoked by Context.Render().\n\n```go\nfunc (e *Echo) Static(path, root string)\n```\nStatic serves static files.\n\n```go\nfunc (e *Echo) Trace(path string, h Handler)\n```\nTrace adds a TRACE route \u003e handler to the router.\n\n```go\nfunc (e *Echo) URI(h Handler, params ...interface{}) string\n```\nURI generates a URI from handler.\n\n```go\nfunc (e *Echo) URL(h Handler, params ...interface{}) string\n```\nURL is an alias for URI\n\n```go\nfunc (e *Echo) Use(m ...Middleware)\n```\nUse adds handler to the middleware chain.\n\n```go\nfunc (e *Echo) WebSocket(path string, h HandlerFunc)\n```\nWebSocket adds a WebSocket route \u003e handler to the router.\n\n```go\ntype Group struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (g *Group) Connect(path string, h Handler)\n```\n\n```go\nfunc (g *Group) Delete(path string, h Handler)\n```\n\n```go\nfunc (g *Group) Get(path string, h Handler)\n```\n\n```go\nfunc (g *Group) Group(prefix string, m ...Middleware) *Group\n```\n\n```go\nfunc (g *Group) Head(path string, h Handler)\n```\n\n```go\nfunc (g *Group) Options(path string, h Handler)\n```\n\n```go\nfunc (g *Group) Patch(path string, h Handler)\n```\n\n```go\nfunc (g *Group) Post(path string, h Handler)\n```\n\n```go\nfunc (g *Group) Put(path string, h Handler)\n```\n\n```go\nfunc (g *Group) Trace(path string, h Handler)\n```\n\n```go\nfunc (g *Group) Use(m ...Middleware)\n```\n\n```go\nfunc (g *Group) WebSocket(path string, h HandlerFunc)\n```\n\n```go\ntype HTTPError struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewHTTPError(code int, msg ...string) *HTTPError\n```\n\n```go\nfunc (e *HTTPError) Code() int\n```\nCode returns code.\n\n```go\nfunc (e *HTTPError) Error() string\n```\nError returns message.\n\n```go\ntype HTTPErrorHandler func(error, *Context)\n```\nHTTPErrorHandler is a centralized HTTP error handler.\n\n```go\ntype Handler interface{}\n```\n\n```go\ntype HandlerFunc func(*Context) error\n```\n\n```go\ntype Middleware interface{}\n```\n\n```go\ntype MiddlewareFunc func(HandlerFunc) HandlerFunc\n```\n\n```go\ntype Renderer interface {\n\tRender(w io.Writer, name string, data interface{}) error\n}\n```\nRenderer is the interface that wraps the Render method.\n\nRender renders the HTML template with given name and specified data. It writes the output to w.\n\n```go\ntype Response struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewResponse(w http.ResponseWriter) *Response\n```\n\n```go\nfunc (r *Response) CloseNotify() \u003c-chan bool\n```\nCloseNotify wraps response writer's CloseNotify function.\n\n```go\nfunc (r *Response) Flush()\n```\nFlush wraps response writer's Flush function.\n\n```go\nfunc (r *Response) Header() http.Header\n```\n\n```go\nfunc (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error)\n```\nHijack wraps response writer's Hijack function.\n\n```go\nfunc (r *Response) SetWriter(w http.ResponseWriter)\n```\n\n```go\nfunc (r *Response) Size() int64\n```\n\n```go\nfunc (r *Response) Status() int\n```\n\n```go\nfunc (r *Response) Write(b []byte) (n int, err error)\n```\n\n```go\nfunc (r *Response) WriteHeader(code int)\n```\n\n```go\nfunc (r *Response) Writer() http.ResponseWriter\n```\n\n```go\ntype Router struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewRouter(e *Echo) (r *Router)\n```\n\n```go\nfunc (r *Router) Add(method, path string, h HandlerFunc, echo *Echo)\n```\n\n```go\nfunc (r *Router) Find(method, path string, ctx *Context) (h HandlerFunc, echo *Echo)\n```\n\n```go\nfunc (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)\n```\n\n","path":"github.com/captaincodeman/echo","name":"echo","synopsis":"","isRedistributable":true}
