Created
May 21, 2016 12:05
-
-
Save AlmogBaku/832700f34f66ffbb63be24b54bbca7e4 to your computer and use it in GitHub Desktop.
Sample HTTP Server written in Go
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
ackage main | |
import ( | |
"fmt" | |
"io" | |
"net/http" | |
) | |
func hello(w http.ResponseWriter, r *http.Request) { | |
io.WriteString(w, "Hello world!") | |
} | |
func main() { | |
http.HandleFunc("/", hello) | |
fmt.Println("Running helo-world-http on http://localhost:8000 ...") | |
http.ListenAndServe(":8000", nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment