How to use with Gin? #196
Answered
by
alek-sys
gaetandezeiraud
asked this question in
Q&A
-
Hello! func (s *Service) AuthHandler() gin.HandlerFunc {
authHandler, _ := s.Handlers()
return func(c *gin.Context) {
authHandler.ServeHTTP(c.Writer, c.Request)
}
} But routes like /auth/list or providers doesn't exist. I have a 404 page not found. Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
alek-sys
Feb 17, 2024
Replies: 1 comment 1 reply
-
You don't need to define your own handler, Gin has a wrapper to use standard authHandler, _ := s.Handlers()
r := gin.Default()
r.Group("/auth").GET("/*path", gin.WrapH(authHandler)) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
gaetandezeiraud
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You don't need to define your own handler, Gin has a wrapper to use standard
net/http
compatible handlers (which is whatauth
provides):