added InitMiddlewares and delete jwtFromBody
Build and Test / build-and-test-backend (push) Successful in 28s
Build and Test / build-and-test-frontend (push) Successful in 33s

This commit is contained in:
wt committed 2025-08-10 14:37:07 +07:00
1 parent 90e5863adc
commit 303b9344f8
3 files changed
+30 -71

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
package server
import (
"os"
jwtware "github.com/gofiber/contrib/jwt"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
)
func InitMiddlewares(app *fiber.App) {
app.Use(
cors.New(
cors.Config{
AllowOrigins: "https://localhost:3000,https://localhost:43243",
AllowHeaders: "*",
AllowCredentials: true,
},
),
jwtware.New(
jwtware.Config{
SigningKey: jwtware.SigningKey{
Key: []byte(os.Getenv("JWT_SECRET_KEY")),
},
},
),
)
}