Created
December 15, 2015 21:14
-
-
Save portalsoup/bd81c0bdc765ade0247f to your computer and use it in GitHub Desktop.
Basic hello world golang 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 ( | |
"net/http" | |
"io" | |
) | |
func helloHandler(w http.ResponseWriter, r *http.Request) { | |
io.WriteString(w, "Hello world!") | |
} | |
func main() { | |
http.HandleFunc("/hello", helloHandler) | |
http.ListenAndServe(":8080", nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment