27 lines
631 B
Go
27 lines
631 B
Go
package handlers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
// HomeHandler 首页处理器
|
|
func HomeHandler(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
response := map[string]string{
|
|
"message": "欢迎使用AnKao Web服务",
|
|
"version": "1.0.0",
|
|
}
|
|
json.NewEncoder(w).Encode(response)
|
|
}
|
|
|
|
// HealthCheckHandler 健康检查处理器
|
|
func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(http.StatusOK)
|
|
response := map[string]string{
|
|
"status": "healthy",
|
|
}
|
|
json.NewEncoder(w).Encode(response)
|
|
}
|