refactor: restructure in entirety
This commit is contained in:
23
internal/handler/health.go
Normal file
23
internal/handler/health.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"billit/internal/database"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// HealthHandlers holds dependencies for health checks
|
||||
type HealthHandlers struct {
|
||||
db database.Service
|
||||
}
|
||||
|
||||
// NewHealthHandlers creates health handlers with db access
|
||||
func NewHealthHandlers(db database.Service) *HealthHandlers {
|
||||
return &HealthHandlers{db: db}
|
||||
}
|
||||
|
||||
// HealthHandler returns the health status
|
||||
func (h *HealthHandlers) HealthHandler(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, h.db.Health())
|
||||
}
|
||||
Reference in New Issue
Block a user