Skip to content

Instantly share code, notes, and snippets.

@gie3d
Created December 26, 2023 13:42
Show Gist options
  • Save gie3d/8c1d2aaa562626ac90f07263fcbebc95 to your computer and use it in GitHub Desktop.
Save gie3d/8c1d2aaa562626ac90f07263fcbebc95 to your computer and use it in GitHub Desktop.
r := gin.New()
// CORS
r.Use(middlewares.Cors())
r.Use(ginrus.Ginrus(loggers.LoggerImpl, time.RFC3339, true))
// Recovery middleware
r.Use(gin.Recovery())
/* --------------------------- Public routes --------------------------- */
public := r.Group("/api/v1")
public.Use(middlewares.DbCloneSession(ds))
public.Use(gzip.Gzip(gzip.DefaultCompression))
public.POST("/login", controllers.Login)
/* --------------------------- Private routes --------------------------- */
private := r.Group("/api/v1")
private.Use(middlewares.DbCloneSession(ds))
// here im using JWT
private.Use(middlewares.Jwt())
private.Use(gzip.Gzip(gzip.DefaultCompression))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment