Created
January 27, 2018 05:14
-
-
Save khajer/56ce6e23de302bc554e04c06165e321a to your computer and use it in GitHub Desktop.
server.go
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" | |
| "net/http" | |
| ) | |
| func HelloHandlers(w http.ResponseWriter, r *http.Request) { | |
| fmt.Fprintf(w, "Hello, world.") | |
| } | |
| func main() { | |
| http.HandleFunc("/", HelloHandlers) // set router | |
| http.ListenAndServe(":8080", nil) // set listen port | |
| fmt.Println("server run at http://localhost:8080"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment