package handlers import ( "net/http" "github.com/labstack/echo/v4" ) func (h *Handler) ReadMembre(c echo.Context) error { membreID := c.Param("membre_id") membre, err := h.DataClient.GetMembre(membreID) if err != nil { if err.Error() == "No membre by that id was found" { return c.JSON(http.StatusNotFound, map[string]string{ "message": "Not Found", }) } return c.JSON(http.StatusInternalServerError, map[string]string{ "message": "Unknown error during GetMembre", "error": err.Error(), }) } return c.JSON(http.StatusOK, map[string]interface{}{ "message": "Read successful", "data": map[string]interface{}{ "membre": &membre, }, }) }