mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
mount static files to routes
This commit is contained in:
parent
e1926523e3
commit
8031c6066e
|
@ -8,6 +8,7 @@ import (
|
|||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/markbates/pkger"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/service"
|
||||
|
@ -205,5 +206,10 @@ func RunServer(ctx context.Context, userConfig *Config, environ *Environment) er
|
|||
c.JSON(200, gin.H{"message": "pong"})
|
||||
})
|
||||
|
||||
fs := pkger.Dir("/frontend/out")
|
||||
r.NoRoute(func(c *gin.Context) {
|
||||
http.FileServer(fs).ServeHTTP(c.Writer, c.Request)
|
||||
})
|
||||
|
||||
return r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user