Skip to content

Instantly share code, notes, and snippets.

@dlsniper
Created June 18, 2017 11:08
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 dlsniper/e57a967dc52f2cf782316cc4cc2a19d4 to your computer and use it in GitHub Desktop.
Save dlsniper/e57a967dc52f2cf782316cc4cc2a19d4 to your computer and use it in GitHub Desktop.
webinar code
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
)
func main() {
r := mux.NewRouter()
r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "user-agent %s", r.Header.Get("user-agent"))
})
http.Handle("/", r)
log.Println("starting server...")
log.Println(http.ListenAndServe(":8000", r))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment