Commit acb55050 authored by Shenghou Ma's avatar Shenghou Ma

net/http: add example for FileServer to mention StripPrefix

        Fixes #3530.

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6032052
parent a6825405
......@@ -49,3 +49,8 @@ func ExampleGet() {
res.Body.Close()
fmt.Printf("%s", robots)
}
func ExampleFileServer() {
// we use StripPrefix so that /tmpfiles/somefile will access /tmp/somefile
http.Handle("/tmpfiles/", http.StripPrefix("/tmpfiles/", http.FileServer(http.Dir("/tmp"))))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment