|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.phc.dm.unipi.it/phc/website/services/server/articles"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/services/server/dev"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/services/server/listautenti"
|
|
|
|
"git.phc.dm.unipi.it/phc/website/services/server/routes"
|
|
|
|
"git.phc.dm.unipi.it/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")
|
|
|
|
|
|
|
|
sl.InjectValue(l, routes.Root, fiber.Router(r))
|
|
|
|
dev.InjectInto(l)
|
|
|
|
|
|
|
|
if err := listautenti.Configure(l); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if err := articles.Configure(l); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &Server{r}, nil
|
|
|
|
}
|