Created
December 26, 2023 13:42
-
-
Save gie3d/8c1d2aaa562626ac90f07263fcbebc95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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