Skip to content

Instantly share code, notes, and snippets.

@AlmogBaku
Created May 21, 2016 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlmogBaku/832700f34f66ffbb63be24b54bbca7e4 to your computer and use it in GitHub Desktop.
Save AlmogBaku/832700f34f66ffbb63be24b54bbca7e4 to your computer and use it in GitHub Desktop.
Sample HTTP Server written in Go
ackage main
import (
"fmt"
"io"
"net/http"
)
func hello(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Hello world!")
}
func main() {
http.HandleFunc("/", hello)
fmt.Println("Running helo-world-http on http://localhost:8000 ...")
http.ListenAndServe(":8000", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment