共计 185 个字符,预计需要花费 1 分钟才能阅读完成。
Golang简单文件服务器,20行代码开启一个http文件服务器,分享运行目录文件
package main import ( "fmt" "net/http" ) func main() { http.Handle("/", http.FileServer(http.Dir("./"))) e := http.ListenAndServe(":8080", nil) fmt.Println(e) }
正文完
共计 185 个字符,预计需要花费 1 分钟才能阅读完成。
Golang简单文件服务器,20行代码开启一个http文件服务器,分享运行目录文件
package main import ( "fmt" "net/http" ) func main() { http.Handle("/", http.FileServer(http.Dir("./"))) e := http.ListenAndServe(":8080", nil) fmt.Println(e) }