Skip to content

Instantly share code, notes, and snippets.

@nelsonsilva
Created August 30, 2011 09:54
Show Gist options
  • Save nelsonsilva/1180574 to your computer and use it in GitHub Desktop.
Save nelsonsilva/1180574 to your computer and use it in GitHub Desktop.
Golang httpd
package main
import (
"http"
"fmt"
)
func HelloServer(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "hello, world!\n");
}
func main() {
http.HandleFunc("/", HelloServer);
err := http.ListenAndServe(":8080", nil);
if err != nil {
panic("ListenAndServe: " + err.String())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment