|
|
|
@ -36,6 +36,7 @@ func NewFiberServer(h handler.Service) *fiber.App {
|
|
|
|
|
return app
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// routes defines routes under "/"
|
|
|
|
|
func routes(h handler.Service, r fiber.Router) {
|
|
|
|
|
//
|
|
|
|
|
// Initial setup
|
|
|
|
@ -152,9 +153,10 @@ func routes(h handler.Service, r fiber.Router) {
|
|
|
|
|
routesApi(h, r.Group("/api"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// routesApi defines routes under "/api"
|
|
|
|
|
func routesApi(h handler.Service, r fiber.Router) {
|
|
|
|
|
r.Get("/api/utenti", func(c *fiber.Ctx) error {
|
|
|
|
|
utenti, err := h.HandleUtenti()
|
|
|
|
|
r.Get("/utenti", func(c *fiber.Ctx) error {
|
|
|
|
|
utenti, err := h.HandleListaUtenti()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -162,7 +164,7 @@ func routesApi(h handler.Service, r fiber.Router) {
|
|
|
|
|
return c.JSON(utenti)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
r.Get("/api/profilo", func(c *fiber.Ctx) error {
|
|
|
|
|
r.Get("/profilo", func(c *fiber.Ctx) error {
|
|
|
|
|
user, err := h.HandleRequiredUser(CreateContext(c))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|