support static files

This commit is contained in:
710leo 2021-04-16 19:20:38 +08:00
parent 3f0dfd63d4
commit bb64a2f1ec
2 changed files with 11 additions and 3 deletions

View File

@ -8,7 +8,6 @@ import (
"strings"
"time"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
"github.com/didi/nightingale/v4/src/common/address"
@ -42,8 +41,6 @@ func Start() {
r.Use(loggerMid)
}
r.Use(static.Serve("/", static.LocalFile("./pub", false)))
Config(r)
initStats()

View File

@ -10,6 +10,17 @@ import (
func Config(r *gin.Engine) {
r.Static("/pub", "./pub")
r.Static("/static", "./pub/static")
r.Static("/layout", "./pub/layout")
r.Static("/ams/", "./pub/ams")
r.Static("/rdb/", "./pub/rdb")
r.Static("/job/", "./pub/job")
r.Static("/mon/", "./pub/mon")
r.StaticFile("/ams", "./pub/layout/index.html")
r.StaticFile("/mon", "./pub/layout/index.html")
r.StaticFile("/job", "./pub/layout/index.html")
r.StaticFile("/rdb", "./pub/layout/index.html")
r.StaticFile("/", "./pub/layout/index.html")
r.StaticFile("/favicon.ico", "./pub/favicon.ico")
pprof.Register(r, "/api/server/debug/pprof")