|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"phc/website/services/server/articles"
|
|
|
|
"phc/website/services/server/dev"
|
|
|
|
"phc/website/services/server/listaUtenti"
|
|
|
|
"phc/website/services/server/routes"
|
|
|
|
"phc/website/sl"
|
|
|
|
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Server struct{ Router *fiber.App }
|
|
|
|
|
|
|
|
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"))
|
|
|
|
|
|
|
|
if err := listaUtenti.Configure(l); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if err := articles.Configure(l); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &Server{r}, nil
|
|
|
|
}
|