From ff4962a62e87f047598237afcb4f4e611656adb5 Mon Sep 17 00:00:00 2001 From: mathias Date: Tue, 6 Oct 2026 13:13:31 +0000 Subject: [PATCH] template: substitute + rename cmd/__PROJECT_NAME__/main.go -> cmd/spatial-agent-app/main.go --- cmd/spatial-agent-app/main.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cmd/spatial-agent-app/main.go diff --git a/cmd/spatial-agent-app/main.go b/cmd/spatial-agent-app/main.go new file mode 100644 index 0000000..a1a81a4 --- /dev/null +++ b/cmd/spatial-agent-app/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "log/slog" + "net/http" + "os" + + "git.d-ma.be/mathias/spatial-agent-app/internal/web" +) + +func main() { + logger := slog.New(slog.NewJSONHandler(os.Stdout, nil)) + + mux := http.NewServeMux() + mux.HandleFunc("/healthz", func(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte("ok")) + }) + mux.Handle("/", web.NewHandler()) + + addr := ":8080" + logger.Info("spatial-agent-app starting", "addr", addr) + if err := http.ListenAndServe(addr, mux); err != nil { + logger.Error("server stopped", "err", err) + os.Exit(1) + } +}