package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("D:/")))
http.ListenAndServe(":2121", nil)
}
运行后访问ip:2121 即可看到D盘下所有文件
package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("D:/")))
http.ListenAndServe(":2121", nil)
}
运行后访问ip:2121 即可看到D盘下所有文件
转载于:https://my.oschina.net/maliang9527/blog/889208