Created
June 18, 2017 11:08
-
-
Save dlsniper/e57a967dc52f2cf782316cc4cc2a19d4 to your computer and use it in GitHub Desktop.
webinar code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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