pull/236/head
zhangchenhao 2025-06-06 18:16:11 +08:00
parent bfe566262b
commit 0724ad79a2
1 changed files with 4 additions and 4 deletions

View File

@ -81,16 +81,16 @@ func Register(r *gin.Engine) {
}
// 1. 提供静态文件服务
r.StaticFS("/static", http.Dir("./build/static")) // 静态资源路径
r.StaticFS("/auto-deploy/static", http.Dir("./build/static")) // 静态资源路径
r.StaticFS("/static", http.Dir("./frontend/static")) // 静态资源路径
r.StaticFS("/auto-deploy/static", http.Dir("./frontend/static")) // 静态资源路径
// 返回 favicon.ico
r.GET("/favicon.ico", func(c *gin.Context) {
c.File("./build/favicon.ico")
c.File("./frontend/favicon.ico")
})
// 3. 前端路由托管:匹配所有其他路由并返回 index.html
r.NoRoute(func(c *gin.Context) {
c.File("./build/index.html")
c.File("./frontend/index.html")
})
// v2 := r.Group("/v2")
// {