Documentation
¶
Index ¶
- Constants
- func ConfigAdd(path string)
- func ErrorHandlerJSON(c *e.Context, err error)
- func ErrorHandlerString(c *e.Context, err error)
- func ErrorStatusCode(err error) int
- func WrapLogger(logger log.Logger) *slog.Logger
- type Options
- type Plugin
- type Server
- func (s *Server) Add(method string, path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) Any(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) File(path, file string, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) Group(prefix string, m ...echo.MiddlewareFunc) *echo.Group
- func (s *Server) HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) Instance() *echo.Echo
- func (s *Server) Match(methods []string, path string, handler echo.HandlerFunc, ...) echo.Routes
- func (s *Server) OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) Options() *Options
- func (s *Server) PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) Pre(middleware ...echo.MiddlewareFunc)
- func (s *Server) Serve(ctx context.Context)
- func (s *Server) Shutdown(ctx context.Context)
- func (s *Server) Static(prefix, root string, m ...echo.MiddlewareFunc) echo.RouteInfo
- func (s *Server) Use(middleware ...echo.MiddlewareFunc)
Constants ¶
const (
// PluginsRoot is the config root every echo v5 plugin key lives under.
PluginsRoot = root + ".plugins"
)
Variables ¶
This section is empty.
Functions ¶
func ConfigAdd ¶
func ConfigAdd(path string)
ConfigAdd registers the echo server config keys under path.
func ErrorHandlerJSON ¶
ErrorHandlerJSON implements JSON content type error handler.
func ErrorHandlerString ¶
ErrorHandlerString implements plain text content type error handler.
func ErrorStatusCode ¶
ErrorStatusCode translates err to the respective HTTP status code.
Types ¶
type Options ¶
type Options struct {
HideBanner bool
DisableHTTP2 bool `config:"disableHTTP2"`
Port int
Type string
Protocol string
TLS struct {
Enabled bool
Type string
Auto struct {
Host string
}
File struct {
Cert string
Key string
}
} `config:"tls"`
Json struct {
Pretty struct {
Enabled bool
}
}
}
Options echo server options.
func NewOptions ¶
NewOptions returns options from config file or environment vars.
func NewOptionsWithPath ¶
NewOptionsWithPath unmarshals a given key path into options and returns it.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents an echo v5 server.
func NewServerWithConfigPath ¶
NewServerWithConfigPath returns a new echo server with options from config path.
func NewServerWithOptions ¶
NewServerWithOptions returns a new echo server with options. A plugin that fails stops the build: the error is returned and later plugins do not run.
func (*Server) Add ¶
func (s *Server) Add(method string, path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
Add registers the handler and middlewares for method route at path.
func (*Server) Any ¶
func (s *Server) Any(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
Any registers the handler and middlewares for all method routes at path.
func (*Server) CONNECT ¶
func (s *Server) CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
CONNECT registers the handler and middlewares for CONNECT route at path.
func (*Server) DELETE ¶
func (s *Server) DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
DELETE registers the handler and middlewares for DELETE route at path.
func (*Server) GET ¶
func (s *Server) GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
GET registers the handler and middlewares for GET route at path.
func (*Server) HEAD ¶
func (s *Server) HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
HEAD registers the handler and middlewares for HEAD route at path.
func (*Server) Match ¶
func (s *Server) Match(methods []string, path string, handler echo.HandlerFunc, middleware ...echo.MiddlewareFunc) echo.Routes
Match registers the handler and middlewares for method routes at path.
func (*Server) OPTIONS ¶
func (s *Server) OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
OPTIONS registers the handler and middlewares for OPTIONS route at path.
func (*Server) PATCH ¶
func (s *Server) PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
PATCH registers the handler and middlewares for PATCH route at path.
func (*Server) POST ¶
func (s *Server) POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
POST registers the handler and middlewares for POST route at path.
func (*Server) PUT ¶
func (s *Server) PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
PUT registers the handler and middlewares for PUT route at path.
func (*Server) Pre ¶
func (s *Server) Pre(middleware ...echo.MiddlewareFunc)
Pre registers middlewares that will run before router.
func (*Server) Serve ¶
Serve starts the echo server and blocks until Shutdown stops it. Errors are logged; the http.ErrServerClosed that Shutdown causes is not an error.
func (*Server) Shutdown ¶
Shutdown stops the echo server gracefully, bounded by ctx. Called before Serve, it makes a later Serve return at once.
func (*Server) Use ¶
func (s *Server) Use(middleware ...echo.MiddlewareFunc)
Use registers middlewares that will run after router.
Directories
¶
| Path | Synopsis |
|---|---|
|
plugins
|
|
|
contrib/swaggo/echo-swagger/v2
Package swagger serves the Swagger UI and the swag docs on an echo v5 server, through github.com/swaggo/echo-swagger/v2.
|
Package swagger serves the Swagger UI and the swag docs on an echo v5 server, through github.com/swaggo/echo-swagger/v2. |