diff options
Diffstat (limited to 'doc/articles/wiki/http-sample.go')
-rw-r--r-- | doc/articles/wiki/http-sample.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/articles/wiki/http-sample.go b/doc/articles/wiki/http-sample.go new file mode 100644 index 000000000..ac8cc4f2d --- /dev/null +++ b/doc/articles/wiki/http-sample.go @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" + "net/http" +) + +func handler(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:]) +} + +func main() { + http.HandleFunc("/", handler) + http.ListenAndServe(":8080", nil) +} |