🎨接入静态文件
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package route
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"wireguard-dashboard/web"
|
||||
)
|
||||
|
||||
type Option func(engine *gin.RouterGroup)
|
||||
|
||||
@@ -17,6 +21,12 @@ func InitRouter() *gin.Engine {
|
||||
// 将请求打印至控制台
|
||||
r.Use(gin.Logger())
|
||||
|
||||
//r.GET("/", func(c *gin.Context) {
|
||||
// c.Redirect(http.StatusMovedPermanently, "/web/")
|
||||
//})
|
||||
|
||||
r.StaticFS("/web", http.FS(web.Static))
|
||||
|
||||
for _, opt := range options {
|
||||
opt(r.Group("api"))
|
||||
}
|
||||
|
Reference in New Issue
Block a user