mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 06:16:37 +08:00
0adc5e8189
- Created `internal/router/root` package to register root-level paths - Moved files serving, robots.txt, and Swagger docs to `root/default.go` - Registered custom root routes under `root/custom.go` - Centralized all v1 routes registration in `internal/router/v1/v1.go` - Simplified `internal/router/router.go` by delegating route registration - Updated `new-api` skill `SKILL.md` to document the new router structure
27 lines
717 B
Go
27 lines
717 B
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Package root registers custom business routes and frontend serving.
|
|
package root
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// RegisterFrontend is a package-level variable overridden by frontend.go when built with embed_frontend.
|
|
var RegisterFrontend = func(_ *gin.Engine) {
|
|
// No-op by default
|
|
}
|
|
|
|
// RegisterRootRoutes registers custom business routes that belong to the root path.
|
|
func RegisterRootRoutes(r *gin.Engine) {
|
|
// 1. Default root routes (/f/:id, /robots.txt, and /swagger/*any)
|
|
RegisterDefaultRootRoutes(r)
|
|
|
|
// 2. Register custom serving
|
|
RegisterCustomRootRoutes(r)
|
|
|
|
// 3. Register frontend serving
|
|
RegisterFrontend(r)
|
|
}
|