summaryrefslogtreecommitdiff
path: root/router.go
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-11-27 11:31:35 +0800
committerEltrac <hi@guhub.cn>2025-11-27 11:31:35 +0800
commitbb58f6cd1d9cce5b12e2f9a30b1c9a6aaefdd54c (patch)
tree8a668165b0f0f57c4fc10a462cf22f2cdbdf5954 /router.go
parenta13c9a7abe43e9e3f21799e8be161422c7fad5a4 (diff)
refactor: move type definitions to types.go also, rename Api to Engine.
Diffstat (limited to 'router.go')
-rw-r--r--router.go12
1 files changed, 1 insertions, 11 deletions
diff --git a/router.go b/router.go
index d608784..961230a 100644
--- a/router.go
+++ b/router.go
@@ -4,16 +4,6 @@ import (
"strings"
)
-type route struct {
- method string
- parts []string
- handler Handler
-}
-
-type Router struct {
- routes []route
-}
-
func NewRouter() *Router {
return &Router{}
}
@@ -24,7 +14,7 @@ func (r *Router) splitPath(path string) []string {
func (r *Router) Add(method string, path string, h Handler) {
parts := r.splitPath(path)
- r.routes = append(r.routes, route{method, parts, h})
+ r.routes = append(r.routes, Route{method, parts, h})
}
func (r *Router) Find(method string, path string) (Handler, map[string]string) {