fix: ora funge tutto anche in production

next
Antonio De Lucreziis 2 years ago
parent 2b47950556
commit d33a4f25ff

@ -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"`

@ -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

@ -7,4 +7,3 @@ import (
)
var Root = sl.NewSlot[fiber.Router]()
var Api = sl.NewSlot[fiber.Router]()

@ -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

Loading…
Cancel
Save