錯誤詳情
- 想要使用不同的路由規則作為靜态檔案伺服器時,通路不到
127.0.0.1/common
package main import ( "net/http" ) func main() { http.Handle("/common/", http.FileServer(http.Dir("./test"))) http.ListenAndServe(":8080", nil) }
解決
-
目錄下沒有test
檔案夾common
- 正确的目錄結構應該是這樣子的
那麼結構如下127.0.0.1/common
----test | ----common | 1.txt