feat: integrated swagger
This commit is contained in:
@@ -6,6 +6,17 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type HealthStatus struct {
|
||||
Healthy bool `json:"healthy"`
|
||||
}
|
||||
|
||||
// @Summary Get health status
|
||||
// @Description Used internally for checking service health
|
||||
// @Tags Service
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} HealthStatus "desc"
|
||||
// @Router /service/health [get]
|
||||
func HealthCheck(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"healthy": true})
|
||||
}
|
||||
|
||||
@@ -2,14 +2,17 @@ package routes
|
||||
|
||||
import (
|
||||
"easywish/internal/controllers"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func SetupRoutes(r *gin.Engine) *gin.Engine {
|
||||
// Healthcheck routes
|
||||
serviceGroup := r.Group("/service")
|
||||
apiGroup := r.Group("/api")
|
||||
{
|
||||
serviceGroup.GET("/health", controllers.HealthCheck)
|
||||
serviceGroup := apiGroup.Group("/service")
|
||||
{
|
||||
serviceGroup.GET("/health", controllers.HealthCheck)
|
||||
}
|
||||
}
|
||||
|
||||
return r
|
||||
|
||||
Reference in New Issue
Block a user