package server import ( "backend/api" "backend/utils" "os" jwtware "github.com/gofiber/contrib/jwt" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/log" "github.com/gofiber/fiber/v2/middleware/cors" ) func Configure(app *fiber.App) { utils.LoadEnv("wallet.conf") log.SetLevel(log.LevelDebug) app.Use(cors.New(cors.Config{ AllowOrigins: "http://localhost:3000", AllowHeaders: "*", })) app.Static("/", "../frontend/build") apiGroup := app.Group("/api") apiGroup.Post("/token", api.Login) apiGroup.Get("/accessible", api.Accessible) app.Use(jwtware.New(jwtware.Config{ SigningKey: jwtware.SigningKey{ Key: []byte(os.Getenv("JWT_SECRET_KEY")), }, })) apiGroup.Get("/rescticted", api.Restricted) operationGroup := apiGroup.Group("/operation") operationGroup.Get("/", api.GetAllOperation) categoryGroup := apiGroup.Group("/category") categoryGroup.Get("/", api.GetAllCategories) }