Health check is empty JSON, 200 OK

main
Yasen Pramatarov 2024-10-17 10:05:49 +03:00
parent 058c616667
commit f0adf3a356
1 changed files with 2 additions and 1 deletions

View File

@ -59,8 +59,9 @@ func readConfig(filePath string) Config {
// Start the health check // Start the health check
func startHealthCheckServer(port int, endpoint string) { func startHealthCheckServer(port int, endpoint string) {
http.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) { http.HandleFunc(endpoint, func(w http.ResponseWriter, r *http.Request) {
// If the server is healthy, the response if 200 OK json, no content
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
w.Write([]byte("Jilo Server is running"))
}) })
address := fmt.Sprintf(":%d", port) address := fmt.Sprintf(":%d", port)