Route defines routes with a common prefix inside the supplied function, scoped to the domain pattern.
(prefix string, fn func(router Router), name ...string)
| 590 | // Route defines routes with a common prefix inside the supplied function, |
| 591 | // scoped to the domain pattern. |
| 592 | func (d *domainRouter) Route(prefix string, fn func(router Router), name ...string) Router { |
| 593 | if fn == nil { |
| 594 | panic("route handler 'fn' cannot be nil") |
| 595 | } |
| 596 | |
| 597 | group := d.Group(prefix) |
| 598 | if len(name) > 0 { |
| 599 | group.Name(name[0]) |
| 600 | } |
| 601 | |
| 602 | fn(group) |
| 603 | |
| 604 | return group |
| 605 | } |
| 606 | |
| 607 | // Name assigns a name to the most recently registered route. |
| 608 | // When the domain router was created from a Group, this delegates to the |