[BREAKING] Déplacer route /v4 vers /v4/health #12
3 changed files with 18 additions and 14 deletions
|
@ -49,7 +49,7 @@ var apiCmd = &cobra.Command{
|
|||
|
||||
// Routes
|
||||
|
||||
e.GET("/v4/", handlers.GetV4)
|
||||
e.GET("/v4/health", handlers.GetHealth)
|
||||
|
||||
e.POST("/v4/membres/", handlers.PostMembres)
|
||||
|
||||
|
|
17
handlers/health.go
Normal file
17
handlers/health.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
type GetHealthResponse struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func GetHealth(c echo.Context) error {
|
||||
response := GetHealthResponse{"Bottin API v4 is ready"}
|
||||
|
||||
return c.JSON(http.StatusOK, response)
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func GetV4(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, map[string]string{
|
||||
"message": "Bottin API v4 is ready",
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue