Last active
December 15, 2015 09:19
Mux and Go
This file contains hidden or 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 api | |
import ( | |
"log" | |
"github.com/gorilla/mux" | |
"http" | |
) | |
func startRouter() { | |
r := mux.NewRouter() | |
r.HandleFunc("/", FooHandler) | |
http.ListenAndServe(":8080", nil) | |
} | |
func FooHandler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment