diff --git a/README.md b/README.md index c694296..412df4c 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ GRRT (Go Request RouTer) is a direct replacement for the archived gorilla/mux. It has built-in CORS and Method based routing. + ## Replaces gorilla/mux with one line of code [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=GolangToolKits_grrt&metric=alert_status)](https://sonarcloud.io/dashboard?id=GolangToolKits_grrt) diff --git a/coverage.out b/coverage.out index e2e2e3e..7f85be6 100644 --- a/coverage.out +++ b/coverage.out @@ -59,11 +59,11 @@ github.com/GolangToolKits/grrt/reqRouter.go:214.96,216.36 2 1 github.com/GolangToolKits/grrt/reqRouter.go:221.2,222.27 2 1 github.com/GolangToolKits/grrt/reqRouter.go:216.36,217.32 1 1 github.com/GolangToolKits/grrt/reqRouter.go:217.32,219.4 1 1 -github.com/GolangToolKits/grrt/router.go:29.25,32.2 2 1 -github.com/GolangToolKits/grrt/router.go:35.46,37.49 2 1 -github.com/GolangToolKits/grrt/router.go:40.2,40.12 1 1 -github.com/GolangToolKits/grrt/router.go:37.49,39.3 1 1 -github.com/GolangToolKits/grrt/router.go:44.72,47.2 2 1 +github.com/GolangToolKits/grrt/router.go:29.25,34.2 4 1 +github.com/GolangToolKits/grrt/router.go:37.46,39.49 2 1 +github.com/GolangToolKits/grrt/router.go:42.2,42.12 1 1 +github.com/GolangToolKits/grrt/router.go:39.49,41.3 1 1 +github.com/GolangToolKits/grrt/router.go:46.72,49.2 2 1 github.com/GolangToolKits/grrt/reqRoute.go:28.32,32.2 3 1 github.com/GolangToolKits/grrt/reqRoute.go:35.56,36.14 1 1 github.com/GolangToolKits/grrt/reqRoute.go:39.2,39.10 1 1 diff --git a/router.go b/router.go index 0c12817..05ed0c5 100644 --- a/router.go +++ b/router.go @@ -27,7 +27,9 @@ type Router interface { // NewRouter NewRouter creates new Router func NewRouter() Router { - var rtn = ReqRouter{namedRoutes: make(map[string]*[]Route)} + var rtn ReqRouter + rtn.namedRoutes = make(map[string]*[]Route) + rtn.prefixRoutes = make(map[string]Route) return &rtn } diff --git a/router_test.go b/router_test.go index 39eb771..304cb84 100644 --- a/router_test.go +++ b/router_test.go @@ -9,6 +9,7 @@ import ( func TestNewRouter(t *testing.T) { var rn = make(map[string]*[]Route) + var px = make(map[string]Route) tests := []struct { name string want Router @@ -18,6 +19,7 @@ func TestNewRouter(t *testing.T) { name: "test 1", want: &ReqRouter{ namedRoutes: rn, + prefixRoutes: px, }, }, }