静态文件,这个加在路由的最后
()
| 64 | |
| 65 | // 静态文件,这个加在路由的最后 |
| 66 | func (this *StaticController) StaticFile() { |
| 67 | file := this.GetString(":splat") |
| 68 | if strings.HasPrefix(file, ".well-known") || file == "sitemap.xml" { |
| 69 | http.ServeFile(this.Ctx.ResponseWriter, this.Ctx.Request, file) |
| 70 | return |
| 71 | } |
| 72 | |
| 73 | file = strings.ReplaceAll(strings.TrimLeft(file, "./"), "\\", "/") |
| 74 | path := filepath.Join(utils.VirtualRoot, file) |
| 75 | http.ServeFile(this.Ctx.ResponseWriter, this.Ctx.Request, path) |
| 76 | } |
| 77 | |
| 78 | // ProjectsFile 书籍静态文件 |
| 79 | func (this *StaticController) ProjectsFile() { |
nothing calls this directly
no outgoing calls
no test coverage detected