Created
May 17, 2017 17:22
-
-
Save allomov/ebb3602b2700198638a0d204ec5f9ba7 to your computer and use it in GitHub Desktop.
Golang Hello World Application on Cloud Foundry
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 handler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hello, Cloud Foundry!\n") | |
} | |
func main() { | |
http.HandleFunc("/", handler) | |
http.ListenAndServe(":"+os.Getenv("PORT"), nil) | |
} |
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
--- | |
applications: | |
- name: hello | |
buildpack: go_buildpack | |
env: | |
GOPACKAGENAME: main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment