diff --git a/app.go b/app.go index 12a4dc348..bb8f46b89 100644 --- a/app.go +++ b/app.go @@ -56,7 +56,9 @@ func New(opts Options) *App { routes: RouteList{}, children: []*App{}, - RouteNamer: baseRouteNamer{}, + RouteNamer: baseRouteNamer{ + Prefix: opts.Prefix, + }, } a.Home.app = a // replace root. a.Home.appSelf = a // temporary, reverse reference to the group app. diff --git a/routenamer.go b/routenamer.go index b6d28058d..aed61267c 100644 --- a/routenamer.go +++ b/routenamer.go @@ -17,10 +17,12 @@ type RouteNamer interface { } // BaseRouteNamer is the default route namer used by apps. -type baseRouteNamer struct{} +type baseRouteNamer struct { + Prefix string +} func (drn baseRouteNamer) NameRoute(p string) string { - if p == "/" || p == "" { + if p == "/" || p == "" || p == drn.Prefix { return "root" }