Skip to content

Instantly share code, notes, and snippets.

@priyadarshan
Forked from fukamachi/hello.go
Last active August 29, 2015 14:27
Show Gist options
  • Save priyadarshan/96d5afccc18752e31e21 to your computer and use it in GitHub Desktop.
Save priyadarshan/96d5afccc18752e31e21 to your computer and use it in GitHub Desktop.
Go Hello World server
package main
import (
"fmt"
"log"
"net/http"
)
func hello(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World")
}
func main() {
http.HandleFunc("/", hello)
if err := http.ListenAndServe(":5000", nil); err != nil {
log.Fatal("ListenAndServe: ", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment