From 8f37e9bb986f83a1dcf36336e6b64c4121ca8c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BC=9F?= Date: Thu, 2 Sep 2021 14:38:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=89=8D=E7=AB=AF=E7=BD=91?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/initialize/router.go | 10 ++++++++++ 1 file changed, 10 insertions(+) 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")