Fixed godoc example for Get() and added example for FileServer
This commit is contained in:
parent
8e892d31ed
commit
beb2f8cca4
|
@ -11,7 +11,7 @@ func hello(w gopher.ResponseWriter, r *gopher.Request) {
|
||||||
w.WriteInfo("Hello World!")
|
w.WriteInfo("Hello World!")
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleClient() {
|
func ExampleGet() {
|
||||||
res, err := gopher.Get("gopher://gopher.floodgap.com")
|
res, err := gopher.Get("gopher://gopher.floodgap.com")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -23,3 +23,9 @@ func ExampleServer() {
|
||||||
gopher.HandleFunc("/hello", hello)
|
gopher.HandleFunc("/hello", hello)
|
||||||
log.Fatal(gopher.ListenAndServe("localhost:7000", nil))
|
log.Fatal(gopher.ListenAndServe("localhost:7000", nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExampleFileServer() {
|
||||||
|
gopher.Handle("/", gopher.FileServer(gopher.Dir("/tmp")))
|
||||||
|
|
||||||
|
log.Fatal(gopher.ListenAndServe("localhost:7000", nil))
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue