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) + } +}