diff --git a/src/config/cors.go b/src/config/cors.go new file mode 100644 index 0000000..0242b24 --- /dev/null +++ b/src/config/cors.go @@ -0,0 +1,9 @@ +package config + +import "github.com/gofiber/fiber/v2/middleware/cors" + +func SetupCors() { + App.Use(cors.New(cors.Config{ + AllowOrigins: "http://localhost:5173", + })) +} diff --git a/src/main.go b/src/main.go index 83b9986..eeaabe1 100644 --- a/src/main.go +++ b/src/main.go @@ -18,6 +18,7 @@ func main() { config.SetupValidator() config.SetupMiddlewares() config.SetupFiber(viewFS) + config.SetupCors() if config.Env.Debug { config.App.Use(cors.New(cors.Config{