2022-09-07 23:34:37 +08:00
|
|
|
package router
|
|
|
|
|
|
|
|
import (
|
2022-09-08 22:00:25 +08:00
|
|
|
"github.com/WHUPRJ/woj-server/internal/api/debug"
|
2022-09-26 16:13:31 +08:00
|
|
|
"github.com/WHUPRJ/woj-server/internal/api/problem"
|
2022-09-08 22:00:25 +08:00
|
|
|
"github.com/WHUPRJ/woj-server/internal/api/user"
|
2022-09-07 23:34:37 +08:00
|
|
|
"github.com/WHUPRJ/woj-server/internal/global"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
// @title OJ Server API Documentation
|
2022-09-17 11:22:55 +08:00
|
|
|
// @version 1.0
|
|
|
|
// @BasePath /api
|
|
|
|
// @securityDefinitions.apikey Authentication
|
|
|
|
// @in header
|
|
|
|
// @name Authorization
|
2022-09-07 23:34:37 +08:00
|
|
|
func setupApi(g *global.Global, root *gin.RouterGroup) {
|
|
|
|
for _, v := range endpoints {
|
|
|
|
group := root.Group(v.Version).Group(v.Path)
|
|
|
|
v.Register(g, group)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-08 22:00:25 +08:00
|
|
|
var endpoints = []global.EndpointInfo{
|
2022-09-07 23:34:37 +08:00
|
|
|
{Version: "", Path: "/debug", Register: debug.RouteRegister},
|
2022-09-08 22:00:25 +08:00
|
|
|
{Version: "/v1", Path: "/user", Register: user.RouteRegister},
|
2022-09-26 16:13:31 +08:00
|
|
|
{Version: "/v1", Path: "/problem", Register: problem.RouteRegister},
|
2022-09-07 23:34:37 +08:00
|
|
|
}
|