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() controller := newController(repo) loadFromFile(controller, "./data.json") mux := web.CreateWebserver(repo) http.ListenAndServe(":8080", mux) } func loadFromFile(c Controller, 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 { c.AddGame(game) } return nil }