MCPcopy
hub / github.com/labstack/echo / Add

Method Add

echo.go:713–727  ·  view source on GitHub ↗

Add registers a new route for an HTTP method and path with matching handler in the router with optional route-level middleware.

(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc)

Source from the content-addressed store, hash-verified

711// Add registers a new route for an HTTP method and path with matching handler
712// in the router with optional route-level middleware.
713func (e *Echo) Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo {
714 ri, err := e.add(
715 Route{
716 Method: method,
717 Path: path,
718 Handler: handler,
719 Middlewares: middleware,
720 Name: "",
721 },
722 )
723 if err != nil {
724 panic(err) // this is how `v4` handles errors. `v5` has methods to have panic-free usage
725 }
726 return ri
727}
728
729// Group creates a new router group with prefix and optional group-level middleware.
730func (e *Echo) Group(prefix string, m ...MiddlewareFunc) (g *Group) {

Callers 14

CONNECTMethod · 0.95
DELETEMethod · 0.95
GETMethod · 0.95
HEADMethod · 0.95
OPTIONSMethod · 0.95
PATCHMethod · 0.95
POSTMethod · 0.95
PUTMethod · 0.95
TRACEMethod · 0.95
RouteNotFoundMethod · 0.95
AnyMethod · 0.95
StaticMethod · 0.95

Calls 1

addMethod · 0.95

Tested by

no test coverage detected