-
-
Notifications
You must be signed in to change notification settings - Fork 186
Expand file tree
/
Copy pathhealth.go
More file actions
45 lines (40 loc) · 1.15 KB
/
health.go
File metadata and controls
45 lines (40 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package handlers
import (
"context"
"net/http"
"github.com/danielgtaylor/huma/v2"
"github.com/getarcaneapp/arcane/types/system"
)
// HealthOutput is the response for health check
type HealthOutput struct {
Body system.HealthResponse
}
// RegisterHealth registers health check routes using Huma.
func RegisterHealth(api huma.API) {
huma.Register(api, huma.Operation{
OperationID: "health-check",
Method: http.MethodGet,
Path: "/health",
Summary: "Health check",
Description: "Check if the API is healthy",
Tags: []string{"Health"},
Security: []map[string][]string{},
}, func(ctx context.Context, input *struct{}) (*HealthOutput, error) {
return &HealthOutput{
Body: system.HealthResponse{
Status: "UP",
},
}, nil
})
huma.Register(api, huma.Operation{
OperationID: "health-check-head",
Method: http.MethodHead,
Path: "/health",
Summary: "Health check (HEAD)",
Description: "Check if the API is healthy (HEAD request)",
Tags: []string{"Health"},
Security: []map[string][]string{},
}, func(ctx context.Context, input *struct{}) (*struct{}, error) {
return nil, nil
})
}