Skip to content

Instantly share code, notes, and snippets.

@bg451
Last active July 14, 2016 18:07
Show Gist options
  • Save bg451/bf19e08ff01d9e78b26be451a5748f10 to your computer and use it in GitHub Desktop.
Save bg451/bf19e08ff01d9e78b26be451a5748f10 to your computer and use it in GitHub Desktop.
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