소스 검색

Rename list page to home page

Gildas Chabot 4 년 전
부모
커밋
497774c0cc
2개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      pages/pages.go
  2. 0 0
      templates/home.html

+ 4 - 4
pages/pages.go

@@ -12,14 +12,14 @@ import (
12
 )
12
 )
13
 
13
 
14
 func Router(c *movies.Collection) http.HandlerFunc {
14
 func Router(c *movies.Collection) http.HandlerFunc {
15
-	listHandler := List(c)
15
+	homeHandler := Home(c)
16
 	movieHandler := Movie(c)
16
 	movieHandler := Movie(c)
17
 
17
 
18
 	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
18
 	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
19
 		path := r.URL.Path
19
 		path := r.URL.Path
20
 		switch {
20
 		switch {
21
 		case path == "/":
21
 		case path == "/":
22
-			listHandler(w, r)
22
+			homeHandler(w, r)
23
 			return
23
 			return
24
 		case path == "/style.css":
24
 		case path == "/style.css":
25
 			http.ServeFile(w, r, "templates/style.css")
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
 	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
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
 		if err != nil {
37
 		if err != nil {
38
 			fmt.Println(err)
38
 			fmt.Println(err)
39
 			return
39
 			return

templates/list.html → templates/home.html