25 lines
403 B
Go
25 lines
403 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type HealthHandler struct {
|
|
startedAt time.Time
|
|
}
|
|
|
|
func NewHealthHandler() *HealthHandler {
|
|
return &HealthHandler{startedAt: time.Now()}
|
|
}
|
|
|
|
func (h *HealthHandler) Check(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"status": "ok",
|
|
"service": "hfb-api",
|
|
"started_at": h.startedAt.Format(time.RFC3339),
|
|
})
|
|
}
|