Files
workspace/code/allapp/allapp-go/api/router/router.go
T
2026-02-27 17:29:28 +08:00

35 lines
865 B
Go

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)
}