initial commit
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"phc/website/model"
|
||||
"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{})
|
||||
|
||||
config := sl.InjectValue[config.Interface](l, &config.Custom{
|
||||
ModeValue: "production",
|
||||
HostValue: ":4000",
|
||||
})
|
||||
|
||||
sl.InjectValue[database.Database](l, &database.Memory{
|
||||
Users: []model.User{
|
||||
{
|
||||
Id: "claire",
|
||||
FullName: "Claire Doe",
|
||||
Nickname: "claire-doe",
|
||||
AuthSources: map[string]model.AuthSource{},
|
||||
},
|
||||
{
|
||||
Id: "john",
|
||||
FullName: "John Smith",
|
||||
Nickname: "john-smith",
|
||||
AuthSources: map[string]model.AuthSource{},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
sl.Inject(l, &dev.Dev{})
|
||||
sl.Inject(l, &lista_utenti.ListaUtenti{})
|
||||
sl.Inject(l, &server.Server{})
|
||||
|
||||
server, err := sl.Use[*server.Server](l)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Fatal(server.Router.Listen(config.Host()))
|
||||
}
|
||||
Reference in New Issue
Block a user