chore: refactor main

This commit is contained in:
2023-06-13 23:35:49 +02:00
parent e34f91fce6
commit e36fddb2b3
5 changed files with 33 additions and 26 deletions
+8 -4
View File
@@ -9,15 +9,19 @@ import (
"git.phc.dm.unipi.it/phc/website/server/routes"
)
func Configure(l *sl.ServiceLocator) error {
type ListaUtenti struct{}
var Slot = sl.NewSlot[*ListaUtenti]()
func Configure(l *sl.ServiceLocator) (*ListaUtenti, error) {
db, err := sl.Use(l, database.Slot)
if err != nil {
return err
return nil, err
}
r, err := sl.Use(l, routes.Root)
if err != nil {
return err
return nil, err
}
r.Get("/api/lista-utenti", func(c *fiber.Ctx) error {
@@ -30,5 +34,5 @@ func Configure(l *sl.ServiceLocator) error {
return c.JSON(users)
})
return nil
return &ListaUtenti{}, nil
}