Created
June 17, 2018 09:18
-
-
Save omarkurt/f8255d8711ddaf5411ca2d7a2def4e95 to your computer and use it in GitHub Desktop.
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 main | |
import ( | |
"net/http" | |
"log" | |
"github.com/gorilla/mux" | |
) | |
func YourHandler(w http.ResponseWriter, r *http.Request) { | |
w.Write([]byte("Gorilla!\n")) | |
} | |
func main() { | |
r := mux.NewRouter() | |
// Routes consist of a path and a handler function. | |
r.HandleFunc("/", YourHandler) | |
// Bind to a port and pass our router in | |
log.Fatal(http.ListenAndServe(":8000", r)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment