Files
backend/cmd/api/main.go
Andriy Oblivantsev 6e2becb06a Implement geo backend, TS client, frontend, and CI tests.
Add a Go HTTP API with Ed25519 auth and invitation onboarding, user-scoped GeoJSON Point management, a Bun-tested @noble/ed25519 TypeScript client, static Vue/Vuetify frontend integration, and a Gitea CI workflow running both Go and Bun test suites.

Made-with: Cursor
2026-03-01 11:41:21 +00:00

39 lines
738 B
Go

package main
import (
"log"
"net/http"
"os"
"time"
"momswap/backend/internal/app"
httpapi "momswap/backend/internal/http"
"momswap/backend/internal/store"
)
func main() {
addr := getEnv("ADDR", ":8080")
adminPublicKey := os.Getenv("ADMIN_PUBLIC_KEY")
memory := store.NewMemoryStore()
service := app.NewService(memory, app.Config{
ChallengeTTL: 5 * time.Minute,
SessionTTL: 24 * time.Hour,
})
service.BootstrapAdmin(adminPublicKey)
api := httpapi.NewAPI(service)
log.Printf("listening on %s", addr)
if err := http.ListenAndServe(addr, api.Routes()); err != nil {
log.Fatalf("listen: %v", err)
}
}
func getEnv(key, fallback string) string {
v := os.Getenv(key)
if v == "" {
return fallback
}
return v
}