package beerpongelo import ( "encoding/json" "net/http" "os" "git.kapelle.org/niklas/beerpong-elo/internal/model" "git.kapelle.org/niklas/beerpong-elo/internal/repo" "git.kapelle.org/niklas/beerpong-elo/internal/web" ) type Config struct { } func Start(config Config) { repo := repo.NewInMemoryRepo() loadFromFile(repo, "./data.json") mux := web.CreateWebserver(repo) http.ListenAndServe(":8080", mux) } func loadFromFile(repo repo.Repo, path string) error { content, err := os.ReadFile(path) if err != nil { return err } var payload []model.Game err = json.Unmarshal(content, &payload) if err != nil { return err } for _, game := range payload { repo.AddGame(game) } return nil }