Skip to content

Instantly share code, notes, and snippets.

@JonathonFry
Created March 10, 2016 14:22
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 JonathonFry/b4abcb05be4b55ceaab5 to your computer and use it in GitHub Desktop.
Save JonathonFry/b4abcb05be4b55ceaab5 to your computer and use it in GitHub Desktop.
Simple http handler using Go
package main
import (
"net/http"
"fmt"
)
func main() {
http.HandleFunc("/", helloWorldHandler)
http.ListenAndServe(":8080", nil)
}
func helloWorldHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello world")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment