Skip to content

Commit

Permalink
support static files
Browse files Browse the repository at this point in the history
  • Loading branch information
710leo committed Apr 16, 2021
1 parent 3f0dfd6 commit bb64a2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/modules/server/http/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -42,8 +41,6 @@ func Start() {
r.Use(loggerMid)
}

r.Use(static.Serve("/", static.LocalFile("./pub", false)))

Config(r)

initStats()
Expand Down
11 changes: 11 additions & 0 deletions src/modules/server/http/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit bb64a2f

Please sign in to comment.