Refactor health check and user management endpoints for improved structure and clarity
- Replaced the existing health check endpoint with a new handler at `/admin/v1/health` to align with the updated API structure. - Introduced a dedicated `health.go` file to encapsulate health check logic and response formatting. - Updated Swagger documentation to reflect the new health check endpoint and its response structure. - Refined user management routes to enhance clarity and maintainability, including changes to login, logout, and profile management endpoints. - Ensured all user-related endpoints are now prefixed appropriately and documented in Swagger for better API usability.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// @Summary Health check
|
||||
// @Description Get server health status
|
||||
// @Tags Health
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} HealthResponse
|
||||
// @Router /health [get]
|
||||
func healthHandler(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, HealthResponse{
|
||||
Status: "healthy",
|
||||
Time: time.Now().Unix(),
|
||||
Version: "1.0.0",
|
||||
})
|
||||
}
|
||||
|
||||
// HealthResponse represents the health check response
|
||||
type HealthResponse struct {
|
||||
Status string `json:"status"`
|
||||
Time int64 `json:"time"`
|
||||
Version string `json:"version"`
|
||||
}
|
||||
Reference in New Issue
Block a user