MCPcopy Index your code
hub / github.com/labstack/echo / WithPrefix

Method WithPrefix

route.go:40–50  ·  view source on GitHub ↗

WithPrefix recreates Route with added group prefix and group middlewares it is grouped to.

(pathPrefix string, middlewares []MiddlewareFunc)

Source from the content-addressed store, hash-verified

38
39// WithPrefix recreates Route with added group prefix and group middlewares it is grouped to.
40func (r Route) WithPrefix(pathPrefix string, middlewares []MiddlewareFunc) Route {
41 r.Path = pathPrefix + r.Path
42
43 if len(middlewares) > 0 {
44 m := make([]MiddlewareFunc, 0, len(middlewares)+len(r.Middlewares))
45 m = append(m, middlewares...)
46 m = append(m, r.Middlewares...)
47 r.Middlewares = m
48 }
49 return r
50}
51
52// RouteInfo contains information about registered Route.
53type RouteInfo struct {

Callers 2

TestRoute_ForGroupFunction · 0.95
AddRouteMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestRoute_ForGroupFunction · 0.76