GO1.5标准包http.FileServer的拔高用法.
2015-08-31 20:45
465 查看
<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)
})
}
相关文章推荐
- RPC failed; result=22, HTTP code = 411
- HTTP Header 属性列表
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- Go 语言 Channel 实现原理精要
- Go语言将支持Android
- 深入HTTP head的使用详解
- ASP 中使用 HTTP 协议发送参数详解
- C#基于socket模拟http请求的方法
- http www安全必备知识
- asp HTTP 500错误 常见问题分析
- http代理相关知识分析
- 在Node.js中使用HTTP上传文件的方法
- php错误提示failed to open stream: HTTP request failed!的完美解决方法
- php提示Failed to write session data错误的解决方法
- PHP5.5和之前的版本empty函数的不同之处
- PHP实现支持GET,POST,Multipart/form-data的HTTP请求类
- C#使用IHttpModule接口修改http输出的方法