package fiber import ( "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" "github.com/gofiber/fiber/v2/middleware/recover" ) func initMiddleware(app *fiber.App, sp ServiceProvider) { app.Use(cors.New(getCORSConfig(sp))) app.Use(recover.New()) } func getCORSConfig(sp ServiceProvider) cors.Config { return cors.Config{ AllowOrigins: sp.ConfigService().CORSAllowOrigins(), AllowMethods: sp.ConfigService().CORSAllowMethods(), } }