Documentation
¶
Overview ¶
Package echoadapter mounts routes on an Echo router while recording each route's contract in an goenax.Registry — one declaration, two outputs: a live route and a spec entry.
Only this adapter knows about Echo; goenax's core stays framework-neutral, so a Gin or net/http adapter is an isolated add-on that never touches the core.
Index ¶
- func Routes(e *echo.Echo) []goenax.Route
- type Router
- func (r *Router) DELETE(path string, h echo.HandlerFunc, opts []goenax.Option, ...)
- func (r *Router) Docs(path string, docs http.Handler, mw ...echo.MiddlewareFunc)
- func (r *Router) GET(path string, h echo.HandlerFunc, opts []goenax.Option, ...)
- func (r *Router) Group(prefix string, mw ...echo.MiddlewareFunc) *Router
- func (r *Router) Handle(method, path string, h echo.HandlerFunc, opts []goenax.Option, ...)
- func (r *Router) PATCH(path string, h echo.HandlerFunc, opts []goenax.Option, ...)
- func (r *Router) POST(path string, h echo.HandlerFunc, opts []goenax.Option, ...)
- func (r *Router) PUT(path string, h echo.HandlerFunc, opts []goenax.Option, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router wraps an Echo mounter and a registry. prefix is the path already applied by the wrapped Echo group, so recorded paths are absolute.
func New ¶
New wraps an Echo router (e.g. e.Group("/api")) together with the registry. prefix must match the Echo group's prefix so the registry records full paths (e.g. "/api").
func (*Router) DELETE ¶
func (r *Router) DELETE(path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc)
DELETE mounts and records a DELETE route.
func (*Router) Docs ¶ added in v0.2.0
Docs mounts a goenax.Docs handler at path and path+"/" (the UI) and path+"/openapi.json" (the spec). The docs routes are not recorded in the spec and are ignored by Coverage. Pass middleware to guard them, e.g. auth in production:
api.Docs("/docs", goenax.Docs(reg, info), requireStaff)
func (*Router) GET ¶
func (r *Router) GET(path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc)
GET mounts and records a GET route.
func (*Router) Group ¶
func (r *Router) Group(prefix string, mw ...echo.MiddlewareFunc) *Router
Group mirrors Echo group nesting while extending the recorded prefix.
func (*Router) Handle ¶
func (r *Router) Handle( method, path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc, )
Handle mounts a route on Echo and records its contract in the registry. path is relative to this Router's prefix (as with Echo groups).
func (*Router) PATCH ¶ added in v0.2.0
func (r *Router) PATCH(path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc)
PATCH mounts and records a PATCH route.
func (*Router) POST ¶
func (r *Router) POST(path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc)
POST mounts and records a POST route.
func (*Router) PUT ¶ added in v0.2.0
func (r *Router) PUT(path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc)
PUT mounts and records a PUT route.