|
@@ -12,14 +12,14 @@ import (
|
12
|
12
|
)
|
13
|
13
|
|
14
|
14
|
func Router(c *movies.Collection) http.HandlerFunc {
|
15
|
|
- listHandler := List(c)
|
|
15
|
+ homeHandler := Home(c)
|
16
|
16
|
movieHandler := Movie(c)
|
17
|
17
|
|
18
|
18
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
19
|
19
|
path := r.URL.Path
|
20
|
20
|
switch {
|
21
|
21
|
case path == "/":
|
22
|
|
- listHandler(w, r)
|
|
22
|
+ homeHandler(w, r)
|
23
|
23
|
return
|
24
|
24
|
case path == "/style.css":
|
25
|
25
|
http.ServeFile(w, r, "templates/style.css")
|
|
@@ -31,9 +31,9 @@ func Router(c *movies.Collection) http.HandlerFunc {
|
31
|
31
|
})
|
32
|
32
|
}
|
33
|
33
|
|
34
|
|
-func List(c *movies.Collection) http.HandlerFunc {
|
|
34
|
+func Home(c *movies.Collection) http.HandlerFunc {
|
35
|
35
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
36
|
|
- t, err := template.ParseFiles("templates/list.html")
|
|
36
|
+ t, err := template.ParseFiles("templates/home.html")
|
37
|
37
|
if err != nil {
|
38
|
38
|
fmt.Println(err)
|
39
|
39
|
return
|