Initial commit

This commit is contained in:
2026-11-16 20:49:40 +02:00
commit eed5a36dd4
32 changed files with 621 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package main
import (
"encoding/json"
"log"
"net/http"
"os"
"time"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(map[string]string{"status": "ok", "service": "api"})
})
// Placeholder only: registration/authentication is not implemented.
mux.HandleFunc("POST /api/v1/auth/register", func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "registration not implemented", http.StatusNotImplemented)
})
addr := os.Getenv("API_ADDR")
if addr == "" {
addr = ":8080"
}
srv := &http.Server{Addr: addr, Handler: mux, ReadHeaderTimeout: 5 * time.Second}
log.Printf("API listening on %s", addr)
log.Fatal(srv.ListenAndServe())
}