Skip to content

Instantly share code, notes, and snippets.

@hugo
Created January 15, 2014 10:01
Show Gist options
  • Save hugo/8433714 to your computer and use it in GitHub Desktop.
Save hugo/8433714 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
"time"
)
func viewHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Date", fmt.Sprintf("%s", time.UTC()))
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.Header().Set("Server", "hello world server")
fmt.Printf(w, "Hello World")
}
func main() {
http.HandleFunc("/", helloWorldHandler)
http.ListenAndServe(":8080", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment