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.
35 lines
617 B
Go
35 lines
617 B
Go
2 years ago
|
package listautenti
|
||
|
|
||
|
import (
|
||
|
"github.com/gofiber/fiber/v2"
|
||
|
|
||
|
"git.phc.dm.unipi.it/phc/website/libs/sl"
|
||
|
|
||
|
"git.phc.dm.unipi.it/phc/website/server/database"
|
||
|
"git.phc.dm.unipi.it/phc/website/server/routes"
|
||
|
)
|
||
|
|
||
|
func Configure(l *sl.ServiceLocator) error {
|
||
|
db, err := sl.Use(l, database.Slot)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
r, err := sl.Use(l, routes.Root)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
r.Get("/api/lista-utenti", func(c *fiber.Ctx) error {
|
||
|
users, err := db.ReadUsers()
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
// TODO: Pre-process data to strip server only fields...
|
||
|
return c.JSON(users)
|
||
|
})
|
||
|
|
||
|
return nil
|
||
|
}
|