Files
wallet/backend/server/InitMiddlewares.go
T
wt 303b9344f8
Build and Test / build-and-test-backend (push) Successful in 28s
Build and Test / build-and-test-frontend (push) Successful in 33s
added InitMiddlewares and delete jwtFromBody
2025-08-10 14:37:07 +07:00

29 lines
510 B
Go

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")),
},
},
),
)
}