<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#0000ff;">package</span><span style=" color:#f57900;"> </span>main
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)
})
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/fyxichen/article/details/48139271