You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// NewHandler initializes the handler with required injected services along with http routes// Does not return as it deals directly with a reference to the gin EnginefuncNewHandler(c*Config) {
// Create a handler (which will later have injected services)h:=&Handler{
ExampleHandler: c.ExampleHandler
} // currently has no properties// setup swaggerc.R.StaticFile("/swagger.json")
opts:= middleware.SwaggerUIOpts{SpecURL: "/swagger.json"}
sh:=middleware.SwaggerUI(opts, nil)
c.R.GET("/docs", gin.WrapH(sh))
// Create an account groupg:=c.R.Group("/v1")
g.GET("/status", h.ApiStatus)
e:=g.Group("/example", VerifyRequestTokenMiddleware)
e.POST("/", h.ExampleHandler)
}
Step3 - Generate Documentation
swagger.yaml can be generated from swagger.json, which be used for the documentation.