-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing Handle and HandleFunc #8
Comments
Requests' routing is orthogonal to http handling. It would be better if routing is implemented in separate packages. I already filed feature request for httprouter. httprouter is much better than the default routing from net/http. As for default router from net/http, it can be substituted by a simple switch in most cases. http.HandleFunc("/foo", fooHandler)
http.HandleFunc("/bar", barHandler)
http.HandleFunc("/baz", bazHandler) is converted to requestHandler := func(ctx *fasthttp.RequestHandler) {
path := ctx.Path()
switch string(path) {
case "/foo":
fooHandler(ctx)
case "/bar":
barHandler(ctx)
case "/baz":
bazHandler(ctx)
}
} |
There is a fasthttprouter forked from httprouter. Have a try. @qwertmax |
@buaazp thanks I'll take a look |
See also the issue #9 . |
@valyala how can i convert
|
are you going to add ?
The text was updated successfully, but these errors were encountered: