Files
OpenList/server/router.go

26 lines
552 B
Go
Raw Normal View History

2020-12-24 01:39:45 +08:00
package server
2020-12-24 15:21:49 +08:00
import (
"github.com/Xhofe/alist/conf"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
)
2020-12-24 01:39:45 +08:00
func InitRouter(engine *gin.Engine) {
engine.Use(CrosHandler())
InitApiRouter(engine)
}
func InitApiRouter(engine *gin.Engine) {
2020-12-24 15:21:49 +08:00
engine.Use(static.Serve("/",static.LocalFile(conf.Conf.Server.Static,false)))
engine.NoRoute(func(c *gin.Context) {
c.File(conf.Conf.Server.Static+"/index.html")
})
v2:=engine.Group("/api")
2020-12-24 01:39:45 +08:00
{
2020-12-24 15:21:49 +08:00
v2.GET("/info",Info)
2020-12-24 01:39:45 +08:00
v2.POST("/get",Get)
v2.POST("/list",List)
v2.POST("/search",Search)
}
}