This commit is contained in:
2026-04-22 18:23:19 +02:00
commit e3e85e4a44
19 changed files with 1273 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
package server
import (
"fmt"
"net/http"
"github.com/fjurmanovic/sugarr/internal/api"
"github.com/fjurmanovic/sugarr/internal/service"
"github.com/fjurmanovic/sugarr/internal/utl/configs"
"github.com/rs/zerolog/log"
)
// Start registers all routes and begins listening. Blocks until the server exits.
func Start(cfg *configs.Config, rec *service.Recommender) error {
mux := http.NewServeMux()
api.Init(mux, cfg, rec)
addr := fmt.Sprintf(":%d", cfg.APIPort)
log.Info().Msgf("HTTP API listening on %s", addr)
return http.ListenAndServe(addr, mux)
}