package handlers import ( "net/http" "git.agecem.com/agecem/bottin/v5/data" "git.agecem.com/agecem/bottin/v5/responses" "github.com/labstack/echo/v4" ) func GetHealth(c echo.Context) error { var response responses.GetHealthResponse dataClient, err := data.NewDataClientFromViper() if err != nil { response.StatusCode = http.StatusInternalServerError response.Message = "Error during data.NewDataClientFromViper()" response.Error = err.Error() return c.JSON(response.StatusCode, response) } defer dataClient.DB.Close() if err = dataClient.DB.Ping(); err != nil { response.StatusCode = http.StatusInternalServerError response.Message = "Error during dataClient.DB.Ping()" response.Error = err.Error() return c.JSON(response.StatusCode, response) } response.StatusCode = http.StatusOK response.Message = "Bottin API v5 is ready" return c.JSON(response.StatusCode, response) }