some progress on static files

This commit is contained in:
Mark McGranaghan
2012-09-20 11:08:37 -07:00
parent 58ea9ce258
commit 3ab1affc1c
2 changed files with 21 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
package main
import "net/http"
func main() {
handler := http.FileServer(http.Dir("./"))
http.ListenAndServe(":5000", handler)
}
// == running
// $ cd src
// $ go run xx-http-server-static.go
//
// $ curl http://127.0.0.1:5000/
// $ curl http://127.0.0.1:5000/xx-http-server-static.go
// $ curl http://127.0.0.1:5000/missing
// == todo
// serving only a subpath as statically