aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-06-06 23:15:14 -0400
committerTeddy Wing2015-06-06 23:18:29 -0400
commita890bc98c9e8a9b106ab97c2863d6dcef34e5e77 (patch)
treea8f94e9bb74cc2b7b86d63070becbfb50dd14f0d
parent7e57f147312fb9858e5071e6211e6e26b0092c17 (diff)
downloadNew-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
-rw-r--r--main.go19
-rw-r--r--static/index.html1
2 files changed, 14 insertions, 6 deletions
diff --git a/main.go b/main.go
index d70d879..adc6ef7 100644
--- a/main.go
+++ b/main.go
@@ -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)
}
diff --git a/static/index.html b/static/index.html
new file mode 100644
index 0000000..557db03
--- /dev/null
+++ b/static/index.html
@@ -0,0 +1 @@
+Hello World