feat: add cors to fiber app
This commit is contained in:
@@ -101,7 +101,7 @@ func (h *AuthHandler) Authenticate(c *fiber.Ctx) error {
|
||||
// @Success 200 {object} dto.OTPProviderResponse
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Failure 500 {object} map[string]string
|
||||
// @Router /auth/send-otp [post]
|
||||
// @Router /auth/otp [post]
|
||||
func (h *AuthHandler) SendOTP(c *fiber.Ctx) error {
|
||||
var req dto.OTPProviderReq
|
||||
if err := c.BodyParser(&req); err != nil {
|
||||
@@ -132,7 +132,7 @@ func (h *AuthHandler) SendOTP(c *fiber.Ctx) error {
|
||||
// @Success 200 {object} dto.OTPVerifyResponse
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Failure 401 {object} map[string]string
|
||||
// @Router /auth/verify-otp [post]
|
||||
// @Router /auth/otp [post]
|
||||
func (h *AuthHandler) VerifyOTP(c *fiber.Ctx) error {
|
||||
var req dto.OTPVerifyRequest
|
||||
if err := c.BodyParser(&req); err != nil {
|
||||
@@ -163,7 +163,7 @@ func (h *AuthHandler) VerifyOTP(c *fiber.Ctx) error {
|
||||
// @Success 200 {object} dto.KYCVerifyResponse
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Failure 500 {object} map[string]string
|
||||
// @Router /auth/verify-kyc [post]
|
||||
// @Router /auth/kyc [post]
|
||||
func (h *AuthHandler) VerifyKYC(c *fiber.Ctx) error {
|
||||
var req dto.KYCVerifyRequest
|
||||
if err := c.BodyParser(&req); err != nil {
|
||||
|
||||
@@ -11,12 +11,15 @@ import (
|
||||
|
||||
"github.com/gofiber/adaptor/v2"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||
httpSwagger "github.com/swaggo/http-swagger"
|
||||
)
|
||||
|
||||
func Run(cfg config.Server, app *app.AppContainer) {
|
||||
fiberApp := fiber.New()
|
||||
|
||||
fiberApp.Use(cors.New())
|
||||
|
||||
// Serve static files (HTML, CSS, JS)
|
||||
fiberApp.Static("/", "./static")
|
||||
|
||||
@@ -47,8 +50,8 @@ func registerPublicRoutes(router fiber.Router, app *app.AppContainer) {
|
||||
// Register auth routes
|
||||
authgroup.Post("/challenge", authHandler.GenerateChallenge)
|
||||
authgroup.Post("/authenticate", authHandler.Authenticate)
|
||||
authgroup.Post("/send-otp", authHandler.SendOTP)
|
||||
authgroup.Post("/verify-otp", authHandler.VerifyOTP)
|
||||
authgroup.Post("/otp", authHandler.SendOTP)
|
||||
authgroup.Post("/verify", authHandler.VerifyOTP)
|
||||
// add JWT middleware for KYC
|
||||
authgroup.Post("/verify-kyc", authHandler.VerifyKYC)
|
||||
authgroup.Post("/kyc", authHandler.VerifyKYC)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user