package news import ( "os" "relynolli-server/handlers/news/endpoints" "relynolli-server/internal" "time" "github.com/gin-contrib/cache" "github.com/gin-gonic/gin" ) func HandleRoutes(parent *gin.RouterGroup) { h := endpoints.GetHandlers() cacheStore := internal.InitCacheStore() catalog := parent.Group("/news") if os.Getenv("IS_PROD") == "1" { // Caching for production usage catalog.GET("", cache.CachePage(cacheStore, 15*time.Minute, h.GetNews)) catalog.GET("/:code", cache.CachePage(cacheStore, 15*time.Minute, h.RetrieveNews)) } else { catalog.GET("", h.GetNews) catalog.GET("/:code", h.RetrieveNews) } }