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)
| 544 | // handle registers a full route to this Party. |
| 545 | // Use Handle or Get, Post, Put, Delete and et.c. instead. |
| 546 | func (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. |
no test coverage detected