Last active
December 30, 2015 06:59
-
-
Save will3942/7793213 to your computer and use it in GitHub Desktop.
Go: Web Server
This file contains 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 ( | |
"fmt" | |
"net/http" | |
) | |
func handlerequest(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hi you accessed post %s", r.URL.Path[1:]) | |
} | |
func main() { | |
http.HandleFunc("/", handlerequest) | |
http.ListenAndServe(":8000", nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment