package main import ( "encoding/json" "log" "os" "phc/website/services/config" "phc/website/services/database" "phc/website/services/server" "phc/website/services/server/dev" "phc/website/sl" ) func main() { l := sl.New() // sl.Inject[config.Interface](l, &config.EnvConfig{}) sl.InjectValue(l, config.Slot, &config.Config{ Mode: "production", Host: ":4000", }) sl.InjectValue(l, database.Slot, database.Database( &database.Memory{}), ) if _, err := server.Configure(l); err != nil { log.Fatal(err) } dev, err := sl.Use(l, dev.Slot) if err != nil { log.Fatal(err) } f, err := os.Create("out/routes.json") if err != nil { log.Fatal(err) } enc := json.NewEncoder(f) enc.SetIndent("", " ") if err := enc.Encode(dev.HtmlRouteBindings); err != nil { log.Fatal(err) } log.Printf(`generated "out/routes.json"`) }