├── Gemfile ├── Gemfile.lock ├── Makefile ├── Procfile ├── README ├── main └── main.go /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | gem "heroku" -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | addressable (2.2.6) 5 | heroku (2.8.0) 6 | launchy (>= 0.3.2) 7 | rest-client (~> 1.6.1) 8 | rubyzip 9 | term-ansicolor (~> 1.0.5) 10 | launchy (2.0.5) 11 | addressable (~> 2.2.6) 12 | mime-types (1.16) 13 | rest-client (1.6.7) 14 | mime-types (>= 1.16) 15 | rubyzip (0.9.4) 16 | term-ansicolor (1.0.6) 17 | 18 | PLATFORMS 19 | ruby 20 | 21 | DEPENDENCIES 22 | heroku 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include $(GOROOT)/src/Make.inc 2 | 3 | TARG=main 4 | GOFILES=\ 5 | main.go\ 6 | 7 | include $(GOROOT)/src/Make.cmd -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: ./main 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcastellm/heroku_go_demo/a7dc5cbcf6e4be52bf6972a143963a097ba18721/README -------------------------------------------------------------------------------- /main: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vcastellm/heroku_go_demo/a7dc5cbcf6e4be52bf6972a143963a097ba18721/main -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "http" 5 | "io" 6 | "log" 7 | "os" 8 | ) 9 | 10 | var port = func() string { 11 | tmpport := os.Getenv("PORT") 12 | if tmpport == "" { 13 | tmpport = "5000" 14 | } 15 | 16 | return tmpport 17 | } 18 | 19 | // hello world, the web server 20 | func HelloServer(w http.ResponseWriter, req *http.Request) { 21 | io.WriteString(w, html) 22 | } 23 | 24 | func main() { 25 | http.HandleFunc("/", HelloServer) 26 | err := http.ListenAndServe(":" + port(), nil) 27 | if err != nil { 28 | log.Fatal("ListenAndServe: ", err.String()) 29 | } 30 | } 31 | 32 | const html = ` 33 | 35 | 36 | 37 |
38 | 39 | 40 |You can clone the project with Git 80 | by running: 81 |
$ git clone git://github.com/victorcoder/heroku_go_demo82 | 83 | 84 | 87 | 88 |