Skip to content

Instantly share code, notes, and snippets.

@cheikhsimsol
Created January 20, 2024 20:11
Show Gist options
  • Save cheikhsimsol/c59ae1211a02c50de13bd939b502a9c7 to your computer and use it in GitHub Desktop.
Save cheikhsimsol/c59ae1211a02c50de13bd939b502a9c7 to your computer and use it in GitHub Desktop.
mux := http.NewServeMux()
// Map a route to handle requests to the root path ("/")
mux.HandleFunc("GET 127.0.0.1/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello")
})
mux.HandleFunc("GET localhost/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Bonjour")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment