Bone is a lightweight and lightning fast HTTP Multiplexer for Golang. It support URL variables, http method declaration and custom NotFound handler.
- BenchmarkBoneMux 10000000 118 ns/op
- BenchmarkZeusMux 100000 144 ns/op
- BenchmarkHttpRouterMux 10000000 134 ns/op
- BenchmarkNetHttpMux 3000000 580 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. Bone do not pretend to be the fastest router for every job. Big project should use a other solution for the moment.
package 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)
}
- DOC
- More Testing
- Debugging
- Optimisation
- Refactoring
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Write Tests!
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
MIT
Middleware Chaining module : Claw