mirror of
https://github.com/Cian-H/simple_blender_server.git
synced 2025-12-23 05:41:56 +00:00
Added basic healthcheck
This commit is contained in:
12
main.go
12
main.go
@@ -18,6 +18,7 @@ const TEMPLATE_FILE = "main.py.tmpl"
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
http.HandleFunc("/create_model", handleCreateModel)
|
http.HandleFunc("/create_model", handleCreateModel)
|
||||||
|
http.HandleFunc("/health", handleHealthCheck)
|
||||||
|
|
||||||
port := os.Getenv("PORT")
|
port := os.Getenv("PORT")
|
||||||
if port == "" {
|
if port == "" {
|
||||||
@@ -190,3 +191,14 @@ func create_glb(model_code string, filename string) (string, error) {
|
|||||||
result := buf.String()
|
result := buf.String()
|
||||||
return result, nil
|
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"))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user