mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-29 23:10:35 +00:00
- Introduced RouteTag middleware to set route tags for different API endpoints. - Updated logger to include route tags in log output. - Applied RouteTag middleware across various routers including API, dashboard, relay, video, and web routers for consistent logging.
24 lines
776 B
Go
24 lines
776 B
Go
package router
|
|
|
|
import (
|
|
"github.com/QuantumNous/new-api/controller"
|
|
"github.com/QuantumNous/new-api/middleware"
|
|
"github.com/gin-contrib/gzip"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func SetDashboardRouter(router *gin.Engine) {
|
|
apiRouter := router.Group("/")
|
|
apiRouter.Use(middleware.RouteTag("old_api"))
|
|
apiRouter.Use(gzip.Gzip(gzip.DefaultCompression))
|
|
apiRouter.Use(middleware.GlobalAPIRateLimit())
|
|
apiRouter.Use(middleware.CORS())
|
|
apiRouter.Use(middleware.TokenAuth())
|
|
{
|
|
apiRouter.GET("/dashboard/billing/subscription", controller.GetSubscription)
|
|
apiRouter.GET("/v1/dashboard/billing/subscription", controller.GetSubscription)
|
|
apiRouter.GET("/dashboard/billing/usage", controller.GetUsage)
|
|
apiRouter.GET("/v1/dashboard/billing/usage", controller.GetUsage)
|
|
}
|
|
}
|