added InitMiddlewares and delete jwtFromBody
This commit is contained in:
1 parent
90e5863adc
commit
303b9344f8
3 files changed
+30
-71
No files matched your search
@@ -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")),
|
||||
},
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user