From bea638aa287d400d6f609ad5afa583fac1503938 Mon Sep 17 00:00:00 2001 From: "Stephen M. McQuay" Date: Mon, 27 Aug 2012 22:45:05 -0600 Subject: [PATCH] Simple http server example --- http-hello/server.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 http-hello/server.go diff --git a/http-hello/server.go b/http-hello/server.go new file mode 100644 index 0000000..bc1efcb --- /dev/null +++ b/http-hello/server.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + "net/http" +) + +type Hello struct{} + +func (h Hello) ServeHTTP( + w http.ResponseWriter, + r *http.Request) { + fmt.Fprint(w, "Hello world") +} + +func main() { + var h Hello + http.ListenAndServe("localhost:4000", h) +}