Cloudreve/routers/router.go

27 lines
455 B
Go
Raw Normal View History

2019-11-04 23:31:22 -05:00
package routers
import (
2019-11-11 06:13:17 -05:00
"cloudreve/middleware"
"cloudreve/pkg/conf"
"cloudreve/routers/controllers"
2019-11-04 23:31:22 -05:00
"github.com/gin-gonic/gin"
)
func InitRouter() *gin.Engine {
r := gin.Default()
2019-11-11 06:13:17 -05:00
// 中间件
r.Use(middleware.Session(conf.SystemConfig.SessionSecret))
2019-11-05 06:49:56 -05:00
// 顶层路由分组
2019-11-04 23:31:22 -05:00
v3 := r.Group("/Api/V3")
{
2019-11-05 06:49:56 -05:00
// 测试用路由
2019-11-04 23:31:22 -05:00
v3.GET("Ping", controllers.Ping)
2019-11-05 06:49:56 -05:00
// 用户登录
2019-11-11 06:13:17 -05:00
v3.POST("User/Session", controllers.UserLogin)
2019-11-04 23:31:22 -05:00
}
return r
}