Skip to content

Instantly share code, notes, and snippets.

@allomov
Created May 17, 2017 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allomov/ebb3602b2700198638a0d204ec5f9ba7 to your computer and use it in GitHub Desktop.
Save allomov/ebb3602b2700198638a0d204ec5f9ba7 to your computer and use it in GitHub Desktop.
Golang Hello World Application on Cloud Foundry
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)
}
---
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