🚧 添加了静态资源

This commit is contained in:
微凉
2020-12-24 15:21:49 +08:00
parent 430b4cf723
commit a7ce9451f3
8 changed files with 43 additions and 7 deletions

View File

@@ -7,7 +7,9 @@ import (
log "github.com/sirupsen/logrus"
)
// TODO:添加前置路由信息
func Info(c *gin.Context) {
c.JSON(200,dataResponse(conf.Conf.Info))
}
func Get(c *gin.Context) {
var get alidrive.GetReq

View File

@@ -1,6 +1,10 @@
package server
import "github.com/gin-gonic/gin"
import (
"github.com/Xhofe/alist/conf"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
)
func InitRouter(engine *gin.Engine) {
engine.Use(CrosHandler())
@@ -8,8 +12,13 @@ func InitRouter(engine *gin.Engine) {
}
func InitApiRouter(engine *gin.Engine) {
v2:=engine.Group("/api/v2")
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")
{
v2.GET("/info",Info)
v2.POST("/get",Get)
v2.POST("/list",List)
v2.POST("/search",Search)