-
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
|
* chore: migrate https://github.com/valyala/tcplisten * chore: merge upstream PR #6 from valyala/tcplisten: Backport TCP backlog size update of uint16->uint32 with Linux * chore: merge upstream PR #10 from valyala/tcplisten: add support for dual-stack socket * refactor: update to modern Go syntax * doc: update README.md * refactor: replace valyala/tcplisten package with custom implementation * fix: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test * fix: golangci-lint * fix: add windows fallback * fix: prevent integer overflow * test: skip TestConfigDeferAccept, TestConfigFastOpen, TestConfigAll on non-linux OS * fix: resolve overflow security issue and use wrapped error * refactor: migrate from syscall to golang.org/x/sys/unix for better compatibility * chore: merge upstream PR #8 from valyala/tcplisten: z/OS Compatibility * refactor: rename tcplisten_bsd.go to tscplisten_other.go
are you going to add ?
The text was updated successfully, but these errors were encountered: