Skip to content
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

Any non mux router support for connectrpc? #752

Closed
tahadostifam opened this issue Jun 17, 2024 · 4 comments
Closed

Any non mux router support for connectrpc? #752

tahadostifam opened this issue Jun 17, 2024 · 4 comments

Comments

@tahadostifam
Copy link

Hi, Recently i've been using connectrpc to handle my json-rpc gateway and i realized connectrpc does not support non http.ServeMux router, right?

Let me know i'm wrong!

@emcfarlane
Copy link
Contributor

Connect-go does support any router that implements the net/http Handler method. For example in the docs for routing the generated handler return the route prefix and a http.Handler which can be directly passed to a server mux. See the generated NewPingServiceHandler for reference to the type signature. Closing, but feel free to ask more questions about specific routers.

@tahadostifam
Copy link
Author

So is there any solution to handle my connectrpc with gin?
Sorry but i'm a little confused😅

@emcfarlane
Copy link
Contributor

For gin use the WrapH to register to the gin handler. This will look something like:

router := gin.Default()
pingServiceRoute, pingServiceHandler := pingv1connect.NewPingServiceHandler()
router.POST(pingServiceRoute, gin.WrapH(pingServiceHandler))

@tahadostifam
Copy link
Author

I got it.
Thank you so much Edward😄❤️🤌🏿

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants