diff --git a/README b/README index 389e758..6860e24 100644 --- a/README +++ b/README @@ -75,7 +75,6 @@ custom error pages * web app * accessing header values and query params * accessing post body - * serve static files http://code.google.com/p/go-wiki/wiki/HttpStaticFiles * simultaneous assignment * mongo * time formatting @@ -84,6 +83,8 @@ custom error pages * set library * base64 encoding * http streaming server +* inline panic + * http streaming client * templating * ssh diff --git a/src/xx-http-server-static.go b/src/xx-http-server-static.go new file mode 100644 index 0000000..8178a65 --- /dev/null +++ b/src/xx-http-server-static.go @@ -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