22 lines
492 B
Go
22 lines
492 B
Go
package address
|
|
|
|
import (
|
|
"github.com/gin-contrib/cache"
|
|
"github.com/gin-gonic/gin"
|
|
"os"
|
|
"relynolli-server/handlers/address/endpoints"
|
|
"relynolli-server/internal"
|
|
"time"
|
|
)
|
|
|
|
func HandleRoutes(parent *gin.RouterGroup) {
|
|
h := endpoints.GetHandlers()
|
|
addr := parent.Group("/address")
|
|
if os.Getenv("IS_PROD") == "1" {
|
|
store := internal.InitCacheStore()
|
|
addr.GET("/search", cache.CachePage(store, 15*time.Minute, h.SearchAddress))
|
|
} else {
|
|
addr.GET("/search", h.SearchAddress)
|
|
}
|
|
}
|