Skip to content

Commit

Permalink
Adds /health route to flights service (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
rspurgeon authored Aug 24, 2023
1 parent 17c8341 commit be0cfc2
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 16 deletions.
47 changes: 31 additions & 16 deletions flight-data/flights/api/flights-server.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flight-data/flights/api/flights.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ func NewFlightService() *FlightService {
return &rv
}

func (s *FlightService) GetHealth(ctx echo.Context) error {
return ctx.JSON(http.StatusOK, map[string]string{"status": "OK"})
}

func (s *FlightService) GetFlights(ctx echo.Context, params models.GetFlightsParams) error {
return ctx.JSON(http.StatusOK, s.Flights)
}
Expand Down
25 changes: 25 additions & 0 deletions flight-data/flights/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,31 @@ servers:
description: KongAir API Server

paths:
/health:
get:
summary: Health check endpoint for Kubernetes
description: Endpoint that returns the service health status.
responses:
'200':
description: Service is healthy
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "OK"
'500':
description: Service is unhealthy
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "unhealthy"
"/flights":
get:
summary: Get KongAir planned flights
Expand Down

0 comments on commit be0cfc2

Please sign in to comment.