18 lines
442 B
Go
18 lines
442 B
Go
|
|
package handler
|
||
|
|
|
||
|
|
import (
|
||
|
|
"encoding/json"
|
||
|
|
"net/http"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Health returns 200 with {"status": "ok"} for Docker healthcheck.
|
||
|
|
func Health(w http.ResponseWriter, r *http.Request) {
|
||
|
|
if r.Method != http.MethodGet {
|
||
|
|
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
w.Header().Set("Content-Type", "application/json")
|
||
|
|
w.WriteHeader(http.StatusOK)
|
||
|
|
_ = json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
|
||
|
|
}
|