debug
This commit is contained in:
6
main.go
6
main.go
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"runtime"
|
"runtime"
|
||||||
@@ -94,8 +93,9 @@ func main() {
|
|||||||
r.HandleFunc("/img/{id}", routers.WebpGet).Methods("GET")
|
r.HandleFunc("/img/{id}", routers.WebpGet).Methods("GET")
|
||||||
|
|
||||||
// 設定靜態資源 (前端) 位于dist目录下
|
// 設定靜態資源 (前端) 位于dist目录下
|
||||||
cacheTime := 7 * 24 * time.Hour
|
//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("/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/")))
|
r.PathPrefix("/").Handler(http.FileServer(http.Dir("./dist/")))
|
||||||
|
|
||||||
//// 設定靜態資源 (前端) 位于dist目录下, 并且为 图片和 js/css 设置缓存时间为7天
|
//// 設定靜態資源 (前端) 位于dist目录下, 并且为 图片和 js/css 设置缓存时间为7天
|
||||||
|
Reference in New Issue
Block a user