diff --git a/server/initialize/router.go b/server/initialize/router.go index d04ced5b..cbb5ffce 100644 --- a/server/initialize/router.go +++ b/server/initialize/router.go @@ -16,6 +16,16 @@ import ( func Routers() *gin.Engine { var Router = gin.Default() + + // 想代理前端网页,修改 web/.env.production 下的 + // VUE_APP_BASE_API = / + // VUE_APP_BASE_PATH = http://localhost + // 然后执行打包命令 npm run build。在打开下面4行注释 + //Router.LoadHTMLGlob("./dist/*.html") // npm打包成dist的路径 + //Router.Static("/favicon.ico", "./dist/favicon.ico") + //Router.Static("/static", "./dist/static") // dist里面的静态资源 + //Router.StaticFile("/", "./dist/index.html") // 前端网页入口页面 + Router.StaticFS(global.GVA_CONFIG.Local.Path, http.Dir(global.GVA_CONFIG.Local.Path)) // 为用户头像和文件提供静态地址 // Router.Use(middleware.LoadTls()) // 打开就能玩https了 global.GVA_LOG.Info("use middleware logger")