PHP
·
发表于 5年以前
·
阅读量:8391
package main
import "net/http"
func main() {
handler := http.FileServer(http.Dir("./"))
http.ListenAndServe(":5000", handler)
}
执行程序:
$ go run static-content.go
$ curl http://127.0.0.1:5000/
$ curl http://127.0.0.1:5000/http-server-static.go
$ curl http://127.0.0.1:5000/missing