MCPcopy Create free account
hub / github.com/kataras/iris / handle

Method handle

core/router/api_builder.go:546–570  ·  view source on GitHub ↗

handle registers a full route to this Party. Use Handle or Get, Post, Put, Delete and et.c. instead.

(errorCode int, method string, relativePath string, handlers ...context.Handler)

Source from the content-addressed store, hash-verified

544// handle registers a full route to this Party.
545// Use Handle or Get, Post, Put, Delete and et.c. instead.
546func (api *APIBuilder) handle(errorCode int, method string, relativePath string, handlers ...context.Handler) *Route {
547 if relativePath == "" {
548 relativePath = "/"
549 }
550
551 routes := api.createRoutes(errorCode, []string{method}, relativePath, handlers...)
552
553 var route *Route // the last one is returned.
554 var err error
555 for _, route = range routes {
556 if route == nil {
557 continue
558 }
559
560 // global
561
562 route.topLink = api.routes.getRelative(route)
563 if route, err = api.routes.register(route, api.routeRegisterRule); err != nil {
564 api.logger.Error(err)
565 break
566 }
567 }
568
569 return route
570}
571
572// HandleMany works like `Handle` but can receive more than one
573// paths separated by spaces and returns always a slice of *Route instead of a single instance of Route.

Callers 2

HandleMethod · 0.95
OnErrorCodeMethod · 0.95

Calls 4

createRoutesMethod · 0.95
getRelativeMethod · 0.80
ErrorMethod · 0.65
registerMethod · 0.45

Tested by

no test coverage detected