package rest import ( "fmt" "log" "github.com/danielgtaylor/huma/v2" humaFiber "github.com/danielgtaylor/huma/v2/adapters/humafiber" "github.com/gofiber/fiber/v2" ) func Init() { app := fiber.New() app.Use(func(c *fiber.Ctx) error { // Logic to execute before the next handler fmt.Printf("Request Method: %s, URL: %s\n", c.Method(), c.OriginalURL()) // Call the next handler in the stack err := c.Next() // Logic to execute after the next handler fmt.Println("Request completed") return err }) config := huma.DefaultConfig("Go API", "1.0.0") config.Servers = []*huma.Server{{}} config.Components.SecuritySchemes = map[string]*huma.SecurityScheme{ "auth": { Type: "http", Scheme: "bearer", BearerFormat: "JWT", }, } api := humaFiber.New(app, config) api.UseMiddleware( func(ctx huma.Context, next func(huma.Context)) { ctx = huma.WithValue(ctx, "humaContext", ctx) next(ctx) }, ) initRouter(api) log.Fatal(app.Listen(fmt.Sprintf(":%s", "3000"))) }