🔗 HTTP router based on radix trees.
testdata | ||
.editorconfig | ||
.gitignore | ||
Benchmarks_test.go | ||
go.mod | ||
go.sum | ||
LICENSE | ||
Parameter.go | ||
README.md | ||
Router.go | ||
Router_test.go | ||
Tree.go | ||
treeNode.go |
router
HTTP router based on radix trees.
Example
We can save any type of data inside the router. Here is an example storing strings for each route:
router := router.New[string]()
router.Add("GET", "/hello", "Hello")
router.Add("GET", "/world", "World")
Benchmarks
Requesting every single route in github.txt:
BenchmarkLookup-12 30147 39105 ns/op 19488 B/op 337 allocs/op
BenchmarkLookupNoAlloc-12 85166 14411 ns/op 0 B/op 0 allocs/op