19 lines
416 B
Go
19 lines
416 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// HealthHandler 健康检查,供容器编排与反向代理探活使用。
|
|
type HealthHandler struct{}
|
|
|
|
// NewHealthHandler 创建健康检查 handler。
|
|
func NewHealthHandler() *HealthHandler { return &HealthHandler{} }
|
|
|
|
// Check GET /api/health
|
|
func (h *HealthHandler) Check(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{"status": "ok"})
|
|
}
|