🎨接入静态文件

This commit is contained in:
coward
2024-05-24 17:31:41 +08:00
parent 5fc8cc8d94
commit 30b7d6aeb6
50 changed files with 993 additions and 1 deletions

View File

@@ -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"))
}