Skip to content

Instantly share code, notes, and snippets.

@omarkurt
Created June 17, 2018 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omarkurt/f8255d8711ddaf5411ca2d7a2def4e95 to your computer and use it in GitHub Desktop.
Save omarkurt/f8255d8711ddaf5411ca2d7a2def4e95 to your computer and use it in GitHub Desktop.
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