diff --git a/main.go b/main.go index bc3a4e1..178b21f 100755 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "log" "net/http" + "path/filepath" "text/template" ) @@ -12,7 +13,7 @@ type StreamURL struct { } func index(w http.ResponseWriter, r *http.Request) { - indexTemplate, err := template.ParseFiles(("index.html")) + indexTemplate, err := template.ParseFiles(filepath.Join("templates", "index.html")) if err != nil { log.Fatal(err) } @@ -27,7 +28,7 @@ func stream(w http.ResponseWriter, r *http.Request) { streamURL := StreamURL{ URL: r.FormValue("URL"), } - streamTemplate, err := template.ParseFiles(("stream.html")) + streamTemplate, err := template.ParseFiles(filepath.Join("templates", "stream.html")) if err != nil { log.Fatal(err) @@ -37,6 +38,9 @@ func stream(w http.ResponseWriter, r *http.Request) { } func main() { + staticFileServer := http.FileServer(http.Dir("./static")) + http.Handle("/static/", http.StripPrefix("/static/", staticFileServer)) + http.HandleFunc("/", index) http.HandleFunc("/stream", stream) log.Fatal(http.ListenAndServe(":8080", nil)) diff --git a/static/js/stream.js b/static/js/stream.js new file mode 100755 index 0000000..66d9aec --- /dev/null +++ b/static/js/stream.js @@ -0,0 +1 @@ +alert("test"); \ No newline at end of file diff --git a/index.html b/templates/index.html similarity index 100% rename from index.html rename to templates/index.html diff --git a/stream.html b/templates/stream.html similarity index 84% rename from stream.html rename to templates/stream.html index 2207758..345674c 100755 --- a/stream.html +++ b/templates/stream.html @@ -1,6 +1,6 @@ - + diff --git a/tmp/air_errors.log b/tmp/air_errors.log new file mode 100644 index 0000000..0427d98 --- /dev/null +++ b/tmp/air_errors.log @@ -0,0 +1 @@ +exit status 2exit status 2exit status 2exit status 2 \ No newline at end of file