diff options
| author | Teddy Wing | 2015-06-06 23:15:14 -0400 |
|---|---|---|
| committer | Teddy Wing | 2015-06-06 23:18:29 -0400 |
| commit | a890bc98c9e8a9b106ab97c2863d6dcef34e5e77 (patch) | |
| tree | a8f94e9bb74cc2b7b86d63070becbfb50dd14f0d /main.go | |
| parent | 7e57f147312fb9858e5071e6211e6e26b0092c17 (diff) | |
| download | New-House-on-the-Block-a890bc98c9e8a9b106ab97c2863d6dcef34e5e77.tar.bz2 | |
main.go: Add static file server
* Temporarily comment out Bitcoin transaction trigger
* Add a static file server to the main function
* Add a sample index.html file that gets served at the root
We'll use this to serve our HTML files for the AngelHack demo.
Used this article as a resource:
http://www.alexedwards.net/blog/serving-static-sites-with-go
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -4,6 +4,7 @@ import ( "com.teddywing/new-house-on-the-block/vendor/_nuts/github.com/fabioberger/coinbase-go" "fmt" "log" + "net/http" "os" ) @@ -28,10 +29,16 @@ func sendMoney(from string, to string, amount string) (transaction_id string, er } func main() { - transaction_id, err := sendMoney("TODO", "n2Qd6da1jiFgij5SSncFKh7MoFN74GdUxv", "0.0001") - if err != nil { - log.Println(err) - } else { - fmt.Println(transaction_id) - } + // transaction_id, err := sendMoney("TODO", "n2Qd6da1jiFgij5SSncFKh7MoFN74GdUxv", "0.0001") + // if err != nil { + // log.Println(err) + // } else { + // fmt.Println(transaction_id) + // } + + fs := http.FileServer(http.Dir("static")) + http.Handle("/", fs) + + log.Println("Listening on port 3000") + http.ListenAndServe(":3000", nil) } |
