Created
April 21, 2019 16:30
-
-
Save farhany/a5eb29da6befab7ceda30e302988b5a8 to your computer and use it in GitHub Desktop.
Minimum Gorilla Web Snippet
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" | |
"github.com/gorilla/mux" | |
) | |
func homeHandler(w http.ResponseWriter, r *http.Request) { | |
w.Write([]byte("Hello!")) | |
} | |
func main() { | |
router := mux.NewRouter().StrictSlash(false) | |
router.Path("/").HandlerFunc(homeHandler).Methods("GET") | |
http.ListenAndServe(":8080", router) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment