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.
website/server/listautenti/listautenti.go

29 lines
525 B
Go

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"
)
func MountApiRoutesHook(l *sl.ServiceLocator, api fiber.Router) error {
db, err := sl.Use(l, database.Slot)
if err != nil {
return err
}
api.Get("/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
}