文件服务

This commit is contained in:
2023-06-22 01:49:14 +08:00
parent 89801bed84
commit 5dc0a475b6

View File

@@ -92,6 +92,7 @@ func main() {
r.HandleFunc("/img/{id}", routers.WebpGet).Methods("GET") r.HandleFunc("/img/{id}", routers.WebpGet).Methods("GET")
// 設定靜態資源 (前端) 位于dist目录下 // 設定靜態資源 (前端) 位于dist目录下
r.PathPrefix("/images/").Handler(http.FileServer(http.Dir("./data/")))
r.PathPrefix("/").Handler(http.FileServer(http.Dir("./dist/"))) r.PathPrefix("/").Handler(http.FileServer(http.Dir("./dist/")))
log.Println("Web Server is running on http://localhost:8080") log.Println("Web Server is running on http://localhost:8080")