2021-07-09 12:13:19 +00:00
|
|
|
package routes
|
|
|
|
|
|
|
|
import (
|
2021-09-27 10:10:19 +00:00
|
|
|
"jokes-bapak2-api/app/handler/health"
|
2021-08-04 09:03:53 +00:00
|
|
|
"time"
|
2021-07-14 18:17:01 +00:00
|
|
|
|
2021-08-04 09:03:53 +00:00
|
|
|
"github.com/gofiber/fiber/v2/middleware/cache"
|
2021-07-09 12:13:19 +00:00
|
|
|
)
|
|
|
|
|
2021-09-27 10:10:19 +00:00
|
|
|
func (d *Dependencies) Health() {
|
2021-07-09 12:13:19 +00:00
|
|
|
// Health check
|
2021-09-26 19:13:38 +00:00
|
|
|
deps := health.Dependencies{
|
2021-09-27 10:10:19 +00:00
|
|
|
DB: d.DB,
|
|
|
|
Redis: d.Redis,
|
|
|
|
Context: d.Context,
|
2021-09-26 19:13:38 +00:00
|
|
|
}
|
2021-09-27 13:02:58 +00:00
|
|
|
|
2021-09-26 19:13:38 +00:00
|
|
|
d.App.Get("/health", cache.New(cache.Config{Expiration: 30 * time.Minute}), deps.Health)
|
2021-09-27 10:10:19 +00:00
|
|
|
d.App.Get("/v1/health", cache.New(cache.Config{Expiration: 30 * time.Minute}), deps.Health)
|
2021-07-09 12:13:19 +00:00
|
|
|
}
|