Skip to content

Instantly share code, notes, and snippets.

@blamh
Last active August 29, 2015 14:18
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 blamh/431639ed95aef065aee5 to your computer and use it in GitHub Desktop.
Save blamh/431639ed95aef065aee5 to your computer and use it in GitHub Desktop.
Test Webserver in go
package main
import (
"fmt"
"net/http"
"time"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "URL:%s, TIME:%s", r.URL.Path[1:], time.Now())
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8000", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment