-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
gorilla mux not working with twirp handler #54
Comments
This should work without much trouble. Like so: svc := example.NewHaberdasherServer(...)
r := mux.NewRouter()
r.PathPrefix(example.HaberdasherPathPrefix).Handler(svc) Could you post the code that isn't working for you? |
Twirp services can only be mounted on the root path. See, the generated service router works on the twirp/example/service.twirp.go Line 156 in dff337b
it looks for an exact match, independently of where it was mounted. Maybe this is the issue? |
Ahh I see. Didn't notice that, I was defining it like this: svc := example.NewHaberdasherServer(...)
r := mux.NewRouter()
r.Handle(example.HaberdasherPathPrefix, svc) Mental note, always mount it on the root path with |
Right, github.com/gorilla/mux uses |
I was trying twirp today to add some calls to an existing service which uses the gorilla mux (https://github.com/gorilla/mux). But the handler from twirp wasn't working with the mux from gorilla. Is this intentional or something we could support in the future?
The
mux
from gorilla implements thehttp.Handler
interface and also theHandle
method for registring ahttp.Handler
with a specific path.The text was updated successfully, but these errors were encountered: