Last active
February 3, 2024 06:39
-
-
Save cheikhsimsol/eb0c31e27cd29969cbee808db9dbe7e3 to your computer and use it in GitHub Desktop.
Classic routing
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
message := "Hello World" | |
// Map a route to handle requests to the root path ("/") | |
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | |
switch r.Method { | |
case http.MethodGet: | |
// get code | |
fmt.Fprint(w, message) | |
case http.MethodPost: | |
// patch Code | |
message = "Hello Zod" | |
fmt.Fprint(w, "Resource Updated") | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment