0.8.5 后端配合前端路由,设定自动跳转改善使用体验

This commit is contained in:
gotoeasy 2022-12-25 12:27:20 +08:00
parent d5172b9d5f
commit 10b74007c6
4 changed files with 11 additions and 9 deletions

View File

@ -177,6 +177,10 @@ func main() {
- [ ] 集群支持动态删减节点(或是页面管理删除)
### 版本`0.8.5`
- [x] 后端配合前端路由,设定自动跳转改善使用体验
### 版本`0.8.4`
- [x] 代码整理优化,前后端升级依赖包

View File

@ -93,7 +93,11 @@ func Run() {
method := cmn.ToUpper(c.Request.Method)
handle := getHttpController(method, path)
if handle == nil {
c.JSON(http.StatusNotFound, Error404())
if cmn.Contains(path, ".") {
c.JSON(http.StatusNotFound, Error404()) // 有后缀名的文件请求找不到则404
} else {
req.Redirect(conf.GetContextPath() + "/") // 默认统一跳转大到[/glc/]
}
return
}

View File

@ -22,14 +22,8 @@ func Run() {
// 过滤器
gweb.RegisterFilter(filter.CrossFilter)
// 控制器(跳转)
gweb.RegisterController(method.GET, "/", html.RedirectToHomeController) // 自动跳转
gweb.RegisterController(method.GET, contextPath, html.RedirectToHomeController) // 自动跳转
gweb.RegisterController(method.GET, contextPath+"/search", html.RedirectToHomeController) // 自动跳转
gweb.RegisterController(method.GET, contextPath+"/storages", html.RedirectToHomeController) // 自动跳转
// Html静态文件
gweb.RegisterController(method.GET, contextPath+"/", html.HomeIndexHtmlController)
gweb.RegisterController(method.GET, contextPath+"/", html.HomeIndexHtmlController) // [响应/glc/]
gweb.RegisterController(method.GET, "/**/*.html", html.StaticFileController)
gweb.RegisterController(method.GET, "/**/*.css", html.StaticFileController)
gweb.RegisterController(method.GET, "/**/*.js", html.StaticFileController)

View File

@ -1,3 +1,3 @@
package onstart
const VERSION = "glogcenter 0.8.4"
const VERSION = "glogcenter 0.8.5"