debug
This commit is contained in:
6
main.go
6
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天
|
||||
|
Reference in New Issue
Block a user