-
Notifications
You must be signed in to change notification settings - Fork 0
/
health.go
36 lines (28 loc) · 857 Bytes
/
health.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package controler
import (
"net/http"
"github.com/labstack/echo/v4"
)
const stateHealthy = "sunshine"
// HealthControler health check controler
type HealthControler interface {
GetHealthCheck(c echo.Context) error
}
type healthControler struct {
}
var _ HealthControler = (*healthControler)(nil)
// NewHealthControler creates a controler for healthcheck
func NewHealthControler() *healthControler {
return &healthControler{}
}
// GetHealthCheck returns wheater this application is alive or not.
// @Summary Gets the application status
// @Description Gets the application status. sunshine means it is working.
// @Tags health
// @Accept json
// @Produce json
// @Success 200 {string} message "sunshine"
// @Router /api/health [get]
func (ctl *healthControler) GetHealthCheck(c echo.Context) error {
return c.JSON(http.StatusOK, stateHealthy)
}