Created
August 13, 2015 22:35
-
-
Save cezarsa/398804c01ee3885fa8b2 to your computer and use it in GitHub Desktop.
basic
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" | |
"os" | |
) | |
func rootHandler(w http.ResponseWriter, r *http.Request) { | |
w.Write([]byte("hello world")) | |
} | |
func main() { | |
port := os.Getenv("PORT") | |
if port == "" { | |
port = "8888" | |
} | |
fmt.Println("listening on", port) | |
http.ListenAndServe("0.0.0.0:"+port, http.HandlerFunc(rootHandler)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment