From a079b3e662bce7e1ef4c1a0a95d900e3b80e87ee Mon Sep 17 00:00:00 2001 From: Lucas Clemente Date: Thu, 28 Apr 2016 17:00:58 +0200 Subject: [PATCH] add -www option to example server --- example/main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/example/main.go b/example/main.go index e88e964a9..cdc4ff03f 100644 --- a/example/main.go +++ b/example/main.go @@ -20,6 +20,7 @@ func main() { bindTo := flag.String("bind", "localhost", "bind to") certPathDefault := os.Getenv("GOPATH") + "/src/github.com/lucas-clemente/quic-go/example/" certPath := flag.String("certpath", certPathDefault, "certificate directory") + www := flag.String("www", "/var/www", "www data") flag.Parse() server, err := quic.NewServer(*certPath+"cert.der", *certPath+"key.der", handleStream) @@ -27,9 +28,7 @@ func main() { panic(err) } - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("Hello world!")) - }) + http.Handle("/", http.FileServer(http.Dir(*www))) err = server.ListenAndServe(*bindTo + ":6121") if err != nil {