文件名称:HTTP多路复用器Bone.zip
文件大小:25KB
文件格式:ZIP
更新时间:2022-08-04 22:35:21
开源项目
Bone 是一个轻量级、非常快速的 HTTP 多路复用器,支持 URL 变量、HTTP 方法声明和自定义 NotFound 处理器。Speed- BenchmarkBoneMux 10000000 118 ns/op - BenchmarkZeusMux 100000 54813 ns/op - BenchmarkHttpRouterMux 10000000 143 ns/op - BenchmarkNetHttpMux 3000000 548 ns/op - BenchmarkGorillaMux 300000 3333 ns/op - BenchmarkGorillaPatMux 1000000 1889 ns/op[ These test are just for fun, all these router are great and really efficient. ]Examplepackage main import( "net/http" "github.com/squiidz/bone" ) func main () { mux := bone.New() // Method takes http.HandlerFunc mux.Get("/home/:id", HomeHandler) mux.Post("/data", DataHandler) // Handle take http.Handler mux.Handle("/", http.HandlerFunc(RootHandler)) http.ListenAndServe(":8080", mux) } 标签:Bone
【文件预览】:
bone-master
----helper_test.go(7KB)
----go.mod(38B)
----helper_17.go(1KB)
----route_test.go(12KB)
----validator.go(1KB)
----bone.go(2KB)
----route.go(6KB)
----bone_bench_test.go(4KB)
----CONTRIBUTING.md(248B)
----.travis.yml(54B)
----example()
--------002()
--------004()
--------003()
--------001()
----LICENSE(1KB)
----bone_test.go(20KB)
----README.md(3KB)
----helper.go(4KB)
----bone_context_test.go(793B)
----mux_test.go(7KB)
----mux.go(4KB)
----CODE_OF_CONDUCT.md(3KB)
----.gitignore(5B)
----helper_15.go(1KB)
----helper_17_test.go(1KB)
----CHANGELOG.md(1KB)