Last active
July 14, 2016 18:07
-
-
Save bg451/bf19e08ff01d9e78b26be451a5748f10 to your computer and use it in GitHub Desktop.
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
func main() { | |
port := 8080 | |
addr := fmt.Sprintf(":%d", port) | |
mux := http.NewServeMux() | |
mux.HandleFunc("/", indexHandler) | |
mux.HandleFunc("/home", homeHandler) | |
mux.HandleFunc("/async", serviceHandler) | |
mux.HandleFunc("/service", serviceHandler) | |
mux.HandleFunc("/db", dbHandler) | |
fmt.Printf("Go to http://localhost:%d/home to start a request!\n", port) | |
log.Fatal(http.ListenAndServe(addr, mux)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment