package server import ( "log" "git.phc.dm.unipi.it/phc/website/libs/sl" "git.phc.dm.unipi.it/phc/website/server/config" "github.com/gofiber/fiber/v2" ) type Server struct{ Router *fiber.App } var Slot = sl.NewSlot[*Server]() var ApiRoutesHook = sl.NewHook[fiber.Router]() func Configure(l *sl.ServiceLocator) (*Server, error) { cfg, err := sl.Use(l, config.Slot) if err != nil { return nil, err } r := fiber.New(fiber.Config{}) r.Static("/assets", "./out/frontend/assets") api := r.Group("/api") if err := sl.UseHook(l, ApiRoutesHook, api); err != nil { return nil, err } go func() { log.Fatal(r.Listen(cfg.Host)) }() return &Server{r}, nil }