GO1.5标准包http.FileServer的拔高用法.

来源:转载

import ( "fmt" "net/http")func main() { h := http.FileServer(http.Dir("./")) http.ListenAndServe(":1789", ce(h))}func ce(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Println(r.URL.Path) h.ServeHTTP(w, r) })}



分享给朋友:
您可能感兴趣的文章:
随机阅读: