From ce95e2f08ffccee272352ab713fbffead911ef32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=9C=E8=8F=AF?= Date: Mon, 10 Jul 2023 10:13:57 +0800 Subject: [PATCH] debug --- main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 12d48ad..e90d9f3 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "log" "net/http" "runtime" @@ -94,8 +93,9 @@ func main() { r.HandleFunc("/img/{id}", routers.WebpGet).Methods("GET") // 設定靜態資源 (前端) 位于dist目录下 - cacheTime := 7 * 24 * time.Hour - r.PathPrefix("/images/").Handler(http.FileServer(http.Dir("./data/"))).Headers("Cache-Control", fmt.Sprintf("max-age=%d", int(cacheTime.Seconds()))) + //cacheTime := 7 * 24 * time.Hour + r.PathPrefix("/images/").Handler(http.FileServer(http.Dir("./data/"))) + //.Headers("Cache-Control", fmt.Sprintf("max-age=%d", int(cacheTime.Seconds()))) r.PathPrefix("/").Handler(http.FileServer(http.Dir("./dist/"))) //// 設定靜態資源 (前端) 位于dist目录下, 并且为 图片和 js/css 设置缓存时间为7天