{"modulePath":"github.com/raphael/echo","version":"v0.0.10","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package echo\n\n## Constants\n\n```go\nconst (\n\tCONNECT = \"CONNECT\"\n\tDELETE  = \"DELETE\"\n\tGET     = \"GET\"\n\tHEAD    = \"HEAD\"\n\tOPTIONS = \"OPTIONS\"\n\tPATCH   = \"PATCH\"\n\tPOST    = \"POST\"\n\tPUT     = \"PUT\"\n\tTRACE   = \"TRACE\"\n\n\tMIMEJSON          = \"application/json\"\n\tMIMEText          = \"text/plain\"\n\tMIMEHTML          = \"text/html\"\n\tMIMEForm          = \"application/x-www-form-urlencoded\"\n\tMIMEMultipartForm = \"multipart/form-data\"\n\n\tHeaderAccept             = \"Accept\"\n\tHeaderContentDisposition = \"Content-Disposition\"\n\tHeaderContentLength      = \"Content-Length\"\n\tHeaderContentType        = \"Content-Type\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\n\t// Errors\n\tErrUnsupportedMediaType = errors.New(\"echo: unsupported media type\")\n\tErrNoRenderer           = errors.New(\"echo: renderer not registered\")\n)\n```\n\n## Functions\n\n```go\nfunc NewRouter(e *Echo) (r *router)\n```\n\n## Types\n\n```go\ntype BindFunc func(*http.Request, interface{}) error\n```\n\n```go\ntype Context struct {\n\tRequest  *http.Request\n\tResponse *response\n\t// contains filtered or unexported fields\n}\n```\nContext represents context for the current request. It holds request and response references, path parameters, data and registered handler.\n\n```go\nfunc (c *Context) Bind(v 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.\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) (err error)\n```\nHTML sends a text/html response with status code.\n\n```go\nfunc (c *Context) JSON(code int, v 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) 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) Set(key string, val interface{})\n```\nSet saves data in the context.\n\n```go\nfunc (c *Context) String(code int, s string) (err error)\n```\nString sends a text/plain response with status code.\n\n```go\ntype Echo struct {\n\tRouter *router\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) Binder(b BindFunc)\n```\nBinder registers a custom binder. It's invoked by Context.Bind API.\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) Delete(path string, h Handler)\n```\nDelete adds a DELETE route \u003e handler to the router.\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(pfx string, m ...Middleware) *Echo\n```\nGroup creates a new sub router with prefix and inherits all properties from the parent. Passing middleware overrides parent middleware.\n\n```go\nfunc (e *Echo) HTTPErrorHandler(h HTTPErrorHandler)\n```\nHTTPErrorHandler registers an HTTP error handler.\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) MaxParam(n uint8)\n```\nMaxParam sets the maximum allowed path parameters. Default is 5, good enough for many users.\n\n```go\nfunc (e *Echo) NotFoundHandler(h Handler)\n```\nNotFoundHandler registers a custom NotFound handler.\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) Renderer(r Renderer)\n```\nRenderer registers an HTML template renderer. It's invoked by Context.Render API.\n\n```go\nfunc (e *Echo) Run(addr string)\n```\nRun runs a server.\n\n```go\nfunc (e *Echo) RunServer(server *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(server *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) 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) Use(m ...Middleware)\n```\nUse adds handler to the middleware chain.\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\nfunc Logger(h HandlerFunc) HandlerFunc\n```\n\n```go\ntype Middleware interface{}\n```\n\n```go\ntype MiddlewareFunc func(HandlerFunc) HandlerFunc\n```\n\n```go\ntype Params []param\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","path":"github.com/raphael/echo","name":"echo","synopsis":"","isRedistributable":true}
