diff options
author | Jackson Taylor <jtaylormuffins@gmail.com> | 2018-06-18 19:32:16 -0400 |
---|---|---|
committer | Jackson Taylor <jtaylormuffins@gmail.com> | 2018-06-18 19:32:16 -0400 |
commit | 5f3dc355f47c50ab4e8cb737bfecb55ccf8a8f85 (patch) | |
tree | 098fb28e5dde8293cc95e72f0a129786c5eb0e2a |
Ok now first commit
-rw-r--r-- | main.go | 41 | ||||
-rw-r--r-- | temp/home.html | 15 | ||||
-rw-r--r-- | todo.txt | 14 |
3 files changed, 70 insertions, 0 deletions
@@ -0,0 +1,41 @@ +package main + +import ( + "fmt" + "html/template" + "net/http" +) + +type HomePage struct { + Title string +} + +func main() { + http.HandleFunc("/", index) + //http.HandleFunc("/movies/", movieIndex) + http.ListenAndServe(":8080", nil) + +} + +func index(w http.ResponseWriter, req *http.Request) { + //w.Header().Set("Content-Type", "text/html") + p := HomePage{Title: "Home"} + + t, err := template.ParseFiles("./temp/home.html") + + if err != nil { + fmt.Println(err) + } + + err = t.Execute(w, p) + + if err != nil { + fmt.Println(err) + fmt.Fprintf(w, "%s", err) + } +} + +// func movieIndex(w http.ResponseWriter, req *http.Request) { +// w.Header().Set("Content-type", "text/html") +// +// } diff --git a/temp/home.html b/temp/home.html new file mode 100644 index 0000000..747dacd --- /dev/null +++ b/temp/home.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> + <head> + <title>JAMA | {{ .Title}}</title> + </head> + <body> + <h1>JAMA</h1> + <div id="movieSection"> + <a href="/movies">Movies</a> + </div> + <div id="showSection"> + <a href="/shows">Shows</a> + </div> + </body> +</html> diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..b7d1f43 --- /dev/null +++ b/todo.txt @@ -0,0 +1,14 @@ +Basic Home Page - Done + - Add CSS and JS + +Serve home page - Done + +create template for movie/show index + -These will probably have to be different because when you + select a movie, it goes straight into it. But Shows will + need another template to show the seasons and then eps + +serve movie/show index + +Video player template + -Work with movies first |