mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 16:46:37 +08:00
docs(skill): update router packaging and categorization guidelines in documentation
- Updated `new-api` skill `SKILL.md` to document the centralized v1.go route registration and domain-driven sub-routing patterns - Updated `AGENTS.md` instructions with the new router subpackages (`root`, `v1`) and route file layout guidelines
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"context"
|
||||
|
||||
capApp "github.com/Rain-kl/Wavelet/internal/apps/cap"
|
||||
publicconfig "github.com/Rain-kl/Wavelet/internal/apps/config"
|
||||
"github.com/Rain-kl/Wavelet/internal/apps/oauth"
|
||||
"github.com/Rain-kl/Wavelet/internal/apps/upload"
|
||||
"github.com/Rain-kl/Wavelet/internal/apps/user"
|
||||
@@ -15,18 +16,39 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// RegisterUserRoutes registers all user-related, oauth and upload routes.
|
||||
func RegisterUserRoutes(apiV1Router *gin.RouterGroup) {
|
||||
// OAuth
|
||||
// RegisterUserRoutes registers all user-related, oauth, upload, and public routes.
|
||||
func RegisterUserRoutes(apiV1Router *gin.RouterGroup, apiGroup *gin.RouterGroup) {
|
||||
// 1. CAPTCHA
|
||||
registerCaptchaRoutes(apiGroup)
|
||||
|
||||
// 2. Config (public)
|
||||
registerConfigRoutes(apiV1Router)
|
||||
|
||||
// 3. OAuth
|
||||
registerOAuthRoutes(apiV1Router)
|
||||
|
||||
// User
|
||||
// 4. User
|
||||
registerUserRoutes(apiV1Router)
|
||||
|
||||
// Upload
|
||||
// 5. Upload
|
||||
registerUploadRoutes(apiV1Router)
|
||||
}
|
||||
|
||||
func registerCaptchaRoutes(apiGroup *gin.RouterGroup) {
|
||||
capGroup := apiGroup.Group("/cap")
|
||||
{
|
||||
capGroup.POST("/challenge", capApp.Challenge)
|
||||
capGroup.POST("/redeem", capApp.Redeem)
|
||||
}
|
||||
}
|
||||
|
||||
func registerConfigRoutes(apiV1Router *gin.RouterGroup) {
|
||||
configRouter := apiV1Router.Group("/config")
|
||||
{
|
||||
configRouter.GET("/public", publicconfig.GetPublicConfig)
|
||||
}
|
||||
}
|
||||
|
||||
func registerOAuthRoutes(apiV1Router *gin.RouterGroup) {
|
||||
apiV1Router.GET("/oauth/sources", oauth.GetLoginSources)
|
||||
apiV1Router.GET("/oauth/login", oauth.GetLoginURL)
|
||||
|
||||
Reference in New Issue
Block a user