MCPcopy
hub / github.com/gofiber/fiber / Group

Method Group

domain.go:560–580  ·  view source on GitHub ↗

Group creates a new sub-router with a common prefix, scoped to the domain pattern. Routes registered through the returned Router also inherit the domain filter.

(prefix string, handlers ...any)

Source from the content-addressed store, hash-verified

558// Group creates a new sub-router with a common prefix, scoped to the domain pattern.
559// Routes registered through the returned Router also inherit the domain filter.
560func (d *domainRouter) Group(prefix string, handlers ...any) Router {
561 fullPrefix := d.registerPath(prefix)
562
563 if len(handlers) > 0 {
564 converted := collectHandlers("domain", handlers...)
565 wrapped := d.wrapHandlers(converted)
566 d.app.register([]string{methodUse}, fullPrefix, d.registerGroup(), wrapped...)
567 }
568
569 // Create a new group on the app
570 newGrp := &Group{Prefix: fullPrefix, app: d.app, parentGroup: d.group}
571 if err := d.app.hooks.executeOnGroupHooks(*newGrp); err != nil {
572 panic(err)
573 }
574
575 return &domainRouter{
576 app: d.app,
577 group: newGrp,
578 matcher: d.matcher,
579 }
580}
581
582// RouteChain creates a Registering instance for the domain router.
583func (d *domainRouter) RouteChain(path string) Register {

Callers 1

RouteMethod · 0.95

Calls 6

registerPathMethod · 0.95
wrapHandlersMethod · 0.95
registerGroupMethod · 0.95
collectHandlersFunction · 0.85
registerMethod · 0.80
executeOnGroupHooksMethod · 0.80

Tested by

no test coverage detected