package router import ( "allapp/api/handler/auth" "allapp/api/handler/space" "allapp/api/router/middleware" "allapp/config" "github.com/gofiber/fiber/v3" ) func SetupRouters(app *fiber.App) { api := app.Group(config.GetConf().Server.BaseUrl) // 1️⃣ 公开接口(无需登录) publicGroup := api.Group("") // 2️⃣ 需要登录 authGroup := api.Group("", middleware.Auth()) // //// 3️⃣ 需要登录 + 需要空间 //spaceGroup := api.Group("", middleware.Auth(), middleware.SpaceGuard()) // -------------------- // auth authRouter := publicGroup.Group("/auth") authRouter.Post("/login/qq", auth.LoginQq) authRouter.Post("/login/wechat", auth.LoginWechat) // 空间操作 authGroup.Post("/space/create", space.CreateSpace) // authGroup.Get("/user/profile", user.GetProfile) // spaceGroup.Get("/space/info", space.GetInfo) }