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

Combine gorilla mux + gin gonic #3185

Open
jmwielandt opened this issue Jun 9, 2022 · 3 comments
Open

Combine gorilla mux + gin gonic #3185

jmwielandt opened this issue Jun 9, 2022 · 3 comments

Comments

@jmwielandt
Copy link

jmwielandt commented Jun 9, 2022

Description

We have a web server done with gorilla mux and we want to migrate it to gin gonic, but we won't going to do it all at once: we wanna do it gradually.

Is there a way to define a gin gonic router and include it inside my gorilla server? Or any other way to acomplish that migration?

Thanks!

@fifsky
Copy link
Contributor

fifsky commented Jun 9, 2022

You may need an API gateway (Ingress, Traefik or nginx) to forward traffic on a specified path to gin Server

@rn0l485
Copy link

rn0l485 commented Jun 14, 2022

Hi @jmwielandt

net/http
gin
gorilla/mux
All of above are implements the http.HandlerFunc, you might be easily rebuild your function.

@adonese
Copy link

adonese commented Sep 15, 2022

You can use a small adapter to serve net/http handler methods from gin, here's an example:

func ginAdapter() gin.HandlerFunc {
	return func(c *gin.Context) {
		yourHandler(c.Writer, c.Request)
	}
}

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

4 participants