Skip to content

Commit

Permalink
Fix some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
markuswustenberg committed Oct 8, 2024
1 parent 5e29579 commit c16b2b9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func (r *Router) Run(ctx Context) error {
}

// Route a [Runner] with the given pattern.
// Routes are matched in the order they were added.
func (r *Router) Route(pattern string, runner Runner) {
r.patterns = append(r.patterns, pattern)
r.runners[pattern] = runner
Expand All @@ -71,8 +72,8 @@ func (r *Router) Branch(pattern string, cb func(r *Router)) {
}

// Scope into a new [Router].
// The middleware from the parent router is copied to the new router,
// but new middleware is only added to the new router, not the parent router.
// The middlewares from the parent router are copied to the new router,
// but new middlewares within the scope are only added to the new router, not the parent router.
func (r *Router) Scope(cb func(r *Router)) {
newR := NewRouter()
newR.middlewares = append(newR.middlewares, r.middlewares...)
Expand Down

0 comments on commit c16b2b9

Please sign in to comment.