This commit is contained in:
2023-06-18 12:55:11 +08:00
parent fdbb2fc2ad
commit 1e8201bb11

View File

@@ -34,9 +34,6 @@ func main() {
})
})
// 設定靜態資源 (前端) 位于dist目录下
r.PathPrefix("/").Handler(http.FileServer(http.Dir("./dist/")))
// 設定路由
r.HandleFunc("/api", routers.GetDocs).Methods("GET")
@@ -94,6 +91,9 @@ func main() {
r.HandleFunc("/img/{id}", routers.WebpGet).Methods("GET")
// 設定靜態資源 (前端) 位于dist目录下
r.PathPrefix("/").Handler(http.FileServer(http.Dir("./dist/")))
log.Println("Web Server is running on http://localhost:8080")
if err := http.ListenAndServe(":8080", r); err != nil {
log.Fatal(err)