package api import ( "context" "loveuer/utodo/internal/handler" "loveuer/utodo/internal/opt" g_handler "loveuer/utodo/pkg/handler" "loveuer/utodo/pkg/middleware/logger" "loveuer/utodo/pkg/middleware/trace" "github.com/go-playground/validator/v10" "github.com/gofiber/fiber/v3" r3 "github.com/gofiber/fiber/v3/middleware/recover" ) type structValidator struct { validate *validator.Validate } func (v *structValidator) Validate(out any) error { return v.validate.Struct(out) } func New(ctx context.Context) *fiber.App { app := fiber.New(fiber.Config{ BodyLimit: 5 * 1024 * 1024, StructValidator: &structValidator{validate: validator.New()}, }) app.Use(trace.New()) // app.Use(l3.New()) app.Use(logger.New()) app.Use(r3.New(r3.Config{EnableStackTrace: true})) app.Get("/healthz", g_handler.Healthz(opt.Cfg.Name, opt.Cfg.Version)) { api := app.Group("/api/v1/auth") api.Post("/login", handler.Login()) api.Post("/verify", handler.Verify("")) } return app }