diff --git a/services/server/dev/dev.go b/services/server/dev/dev.go index 9a67362..930551b 100644 --- a/services/server/dev/dev.go +++ b/services/server/dev/dev.go @@ -79,19 +79,19 @@ func Configure(l *sl.ServiceLocator) (*devService, error) { map[string]Handler{}, } - api, err := sl.Use(l, routes.Api) + r, err := sl.Use(l, routes.Root) if err != nil { return nil, err } - api.Get("/development/routes", func(c *fiber.Ctx) error { + r.Get("/api/development/routes", func(c *fiber.Ctx) error { return c.JSON(map[string]any{ "static": d.staticRoutes, "dynamic": d.dynamicRoutes, }) }) - api.Post("/development/render", func(c *fiber.Ctx) error { + r.Post("/api/development/render", func(c *fiber.Ctx) error { var data struct { Route string `json:"route"` Page string `json:"page"` diff --git a/services/server/listaUtenti/lista-utenti.go b/services/server/listaUtenti/lista-utenti.go index 28d1b82..a281c7c 100644 --- a/services/server/listaUtenti/lista-utenti.go +++ b/services/server/listaUtenti/lista-utenti.go @@ -17,12 +17,12 @@ func Configure(l *sl.ServiceLocator) error { return err } - api, err := sl.Use(l, routes.Api) + r, err := sl.Use(l, routes.Root) if err != nil { return err } - api.Get("/lista-utenti", func(c *fiber.Ctx) error { + r.Get("/api/lista-utenti", func(c *fiber.Ctx) error { users, err := db.ReadUsers() if err != nil { return err diff --git a/services/server/routes/routes.go b/services/server/routes/routes.go index 742db29..45c2e28 100644 --- a/services/server/routes/routes.go +++ b/services/server/routes/routes.go @@ -7,4 +7,3 @@ import ( ) var Root = sl.NewSlot[fiber.Router]() -var Api = sl.NewSlot[fiber.Router]() diff --git a/services/server/server.go b/services/server/server.go index c130ace..42944ab 100644 --- a/services/server/server.go +++ b/services/server/server.go @@ -16,10 +16,8 @@ func Configure(l *sl.ServiceLocator) (*Server, error) { r := fiber.New(fiber.Config{}) r.Static("/assets", "./out/frontend/assets") - dev.InjectInto(l) - sl.InjectValue(l, routes.Root, fiber.Router(r)) - sl.InjectValue(l, routes.Api, r.Group("/api")) + dev.InjectInto(l) if err := listaUtenti.Configure(l); err != nil { return nil, err