[FEAT][API] Get health endpoint
- Dominant language
- Go
- Stars
- 6
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Description
Adds a health endpoint to verify server health.
## Request
### Method
GET
### URL
/health
### Request Parameters
None
### Request Body
None
## Result
### Result parameters
None
### Result Body
None
## Example Curl Request
### Request
```
curl -X GET http://localhost:8080/health
```
### Curl Response
```
HTTP/1.1 200 OK
Content-Length: 0
```
## Go server
### Struct
```go
type HealthResponse struct{}
```
### Handler
```go
func (s *Server) GetHealth(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
return
}
```healthy" or "unhealthy"
Status string `json:"status"`
}
```
### Handler
```go
// GetHealth godoc
// @Summary Get health
// @Tags health
// @Accept json
// @Produce json
// @Success 200 {object} HealthResponse
// @Router /health [get]
func (h *handler) GetHealth(c *gin.Context) {
h.logger.Infof("Get health request received")
c.JSON(http.StatusOK, HealthResponse{Status: "healthy"})
}
```
## Links
- [Health.get_health](https://github.com/octopize/avatar-python/blob/0.6.2/avatars/api.py#L419)
- [Any](https://github.com/octopize/avatar-python/blob/0.6.2/avatars/api.py#L419)
## Automated Issue Details
Dear visitor,
This issue has been automatically generated from the Octopize project [avatar-python](https://github.com/octopize/avatar-python/) to make SIGO compatible. Please vote with a thumbs up or thumbs down to assess the quality of the automatic generation.
Best regards,
The SIGO Team
Contributor guide
Research direction
Locate the existing Go server and route registration first, then inspect how current handlers and API responses are tested. Clarify whether GET /health should return an empty 200 response or JSON containing status: "healthy", since the issue specifies both. Done means the agreed contract is routed at /health and verified by the relevant API tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100