[+] добавил cors

This commit is contained in:
Ivan Titov 2025-02-15 13:12:16 +03:00
parent d3b3d3c870
commit 763a38e157

View File

@ -5,6 +5,7 @@ import (
"jwt_service/internal/routes" "jwt_service/internal/routes"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
) )
func main() { func main() {
@ -12,6 +13,11 @@ func main() {
app := fiber.New() app := fiber.New()
app.Use(cors.New(cors.Config{
AllowCredentials: true,
AllowOrigins: "http://127.0.0.1", //Very important while using a HTTPonly Cookie, frontend can easily get and return back the cookie.
}))
routes.Setup(app) routes.Setup(app)
app.Listen(":8000") app.Listen(":8000")