FileServer
代码
package main
import (
"io"
"log"
"net/http"
)
func main() {
http.Handle("/dir",http.StripPrefix("/dir", http.FileServer(http.Dir("/usr/local/"))))
err := http.ListenAndServe(":8080", nil)
//err := http.ListenAndServe(":8080",http.FileServer(http.Dir("/usr/local/")))
if err != nil {
log.Fatal("...")
}
}