You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
975 B
Go
52 lines
975 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
"os"
|
|
"phc/website/services/config"
|
|
"phc/website/services/database"
|
|
"phc/website/services/server"
|
|
"phc/website/services/server/dev"
|
|
lista_utenti "phc/website/services/server/lista-utenti"
|
|
"phc/website/sl"
|
|
)
|
|
|
|
func main() {
|
|
l := sl.New()
|
|
|
|
// sl.Inject[config.Interface](l, &config.EnvConfig{})
|
|
|
|
sl.InjectValue[config.Interface](l, &config.Custom{
|
|
ModeValue: "production",
|
|
HostValue: ":4000",
|
|
})
|
|
|
|
sl.InjectValue[database.Database](l, &database.Memory{})
|
|
|
|
sl.Inject(l, &dev.Dev{})
|
|
sl.Inject(l, &lista_utenti.ListaUtenti{})
|
|
sl.Inject(l, &server.Server{})
|
|
|
|
_, err := sl.Use[*server.Server](l)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
dev, err := sl.Use[*dev.Dev](l)
|
|
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)
|
|
}
|
|
}
|