diff --git a/main.go b/main.go index e2473bd..bddc4cb 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,7 @@ const TEMPLATE_FILE = "main.py.tmpl" func main() { http.HandleFunc("/create_model", handleCreateModel) + http.HandleFunc("/health", handleHealthCheck) port := os.Getenv("PORT") if port == "" { @@ -190,3 +191,14 @@ func create_glb(model_code string, filename string) (string, error) { result := buf.String() return result, nil } + +func handleHealthCheck(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", "text/plain") + w.WriteHeader(http.StatusOK) + w.Write([]byte("OK")) +}