From bdd5e65ebfcaaaeee0bca448213254db61fc6af4 Mon Sep 17 00:00:00 2001 From: Joe Wroten Date: Fri, 21 Jun 2019 12:24:56 -0500 Subject: [PATCH] Go Hello World Server --- go/hello-world-server.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 go/hello-world-server.go diff --git a/go/hello-world-server.go b/go/hello-world-server.go new file mode 100644 index 0000000..caaf14c --- /dev/null +++ b/go/hello-world-server.go @@ -0,0 +1,16 @@ +package main + +import ( + "fmt" + "net/http" +) + +func main() { + http.HandleFunc("/", homepage) + fmt.Println("Server is running on http://localhost:8081") + http.ListenAndServe(":8081", nil) +} + +func homepage(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "

Hello World

") +}