瀏覽代碼

Also cache static files

Florian Hoss 2 年之前
父節點
當前提交
5aca62e586
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      router.go

+ 6 - 1
router.go

@@ -4,9 +4,14 @@ func (g *goDash) setupRouter() {
 	g.router.GET("/", g.index)
 	g.router.GET("/ws", g.ws)
 	g.router.GET("/robots.txt", robots)
-	g.router.Static("/static", "static")
+
+	static := g.router.Group("/static")
+	static.Use(longCacheLifetime)
+	static.Static("/", "static")
+
 	storage := g.router.Group("/storage")
 	storage.Use(longCacheLifetime)
 	storage.Static("/icons", "storage/icons")
+
 	g.router.RouteNotFound("/*", redirectHome)
 }