package main import ( "encoding/json" "log" "net/http" "os" "time" ) func main() { port := os.Getenv("PORT") if port == "" { port = "8080" } http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(map[string]string{"utc": time.Now().UTC().Format(time.RFC3339)}) }) http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("ok\n")) }) log.Printf("listening on :%s", port) log.Fatal(http.ListenAndServe(":"+port, nil)) }