Created
August 1, 2019 07:56
-
-
Save sahajre/8e05971323f43492dd98f3d0d485bbf0 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 ( | |
| "fmt" | |
| "log" | |
| "net/http" | |
| ) | |
| func main() { | |
| http.HandleFunc("/", helloWorldHandler) | |
| printInstructions() | |
| log.Fatal(http.ListenAndServe("localhost:8080", nil)) | |
| } | |
| func helloWorldHandler(w http.ResponseWriter, r *http.Request) { | |
| fmt.Fprintln(w, "Hello, 世界") | |
| } | |
| func printInstructions() { | |
| fmt.Println(`Visit http://localhost:8080 in the web browser to see "Hello, 世界"`) | |
| fmt.Println(`After that Press control+c to stop the server`) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment