diff options
Diffstat (limited to 'internal/router/attach.go')
-rw-r--r-- | internal/router/attach.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/router/attach.go b/internal/router/attach.go index 88364831a..7c20b33d8 100644 --- a/internal/router/attach.go +++ b/internal/router/attach.go @@ -39,3 +39,10 @@ func (r *router) AttachMiddleware(middleware gin.HandlerFunc) { func (r *router) AttachNoRouteHandler(handler gin.HandlerFunc) { r.engine.NoRoute(handler) } + +// AttachGroup attaches the given handlers into a group with the given relativePath as +// base path for that group. It then returns the *gin.RouterGroup so that the caller +// can add any extra middlewares etc specific to that group, as desired. +func (r *router) AttachGroup(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup { + return r.engine.Group(relativePath, handlers...) +} |