Initial revision

Package net/http has couple of examples how to get started. Put some of it together and you get the following application (app). Save that into $HOME/tutorial/cmd/app/main.go
+package main + +import ( + "fmt" + "log" + "net/http" +) + +func main() { + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, "Hello, World!") + }) + log.Fatal(http.ListenAndServe(":8080", nil)) +}
prev toc next