summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-09-15 16:20:03 -0600
committertjpcc <tjp@ctrl-c.club>2023-09-15 16:20:03 -0600
commit73f18bcd3a754e8a59100dd165d048a749aab1fe (patch)
tree04107115e07a021c73c59ffb84fc5b8769bed1a5
parent15035206f46eb258e482d20ea8d49a232f2d5161 (diff)
include the root route in pathtree.Routes()
-rw-r--r--internal/pathtree.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/pathtree.go b/internal/pathtree.go
index 3861c8e..25d000d 100644
--- a/internal/pathtree.go
+++ b/internal/pathtree.go
@@ -38,7 +38,11 @@ type Route[V any] struct {
}
func (pt PathTree[V]) Routes() []Route[V] {
- return pt.tree.routes()
+ routes := pt.tree.routes()
+ if pt.root != nil {
+ routes = append([]Route[V]{{Pattern: "", Value: *pt.root}}, routes...)
+ }
+ return routes
}
// pattern segment which must be a specific string ("/users/").