Skip to content

Commit f9b5e64

Browse files
committed
you're doing great
1 parent 5faf8c5 commit f9b5e64

File tree

4 files changed

+81
-1
lines changed

4 files changed

+81
-1
lines changed

000_temp/75/main.go

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,51 @@ import (
55
"net/http"
66
)
77

8-
var tpl = template.New("pale")
8+
const s = `<!doctype html>
9+
<html lang="en">
10+
<head>
11+
<meta charset="UTF-8">
12+
<meta name="viewport"
13+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
14+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
15+
<title>CONTACT 4</title>
16+
</head>
17+
<body>
18+
19+
<h1>YOU ARE AT CONTACT 4</h1>
20+
21+
<a href="/">HOME</a>
22+
<a href="/about">ABOUT</a>
23+
<a href="/contact/2">CONTACT 2</a>
24+
<a href="/contact/3">CONTACT 3</a>
25+
<a href="/contact/4">CONTACT 4</a>
26+
27+
28+
29+
</body>
30+
</html>`
31+
32+
var tpl *template.Template
33+
var tpl2 *template.Template
34+
var tpl3 *template.Template
35+
var tpl4 *template.Template
936

1037
func init() {
1138
tpl = template.Must(template.ParseGlob("templates/*.gohtml"))
39+
40+
tpl2 = template.Must(template.New("pale").ParseFiles("templates/contact.gohtml"))
41+
42+
tpl3 = template.Must(template.ParseFiles("templates/contact.gohtml"))
43+
44+
tpl4 = template.Must(template.New("pale").Parse(s))
1245
}
1346

1447
func main() {
1548
http.HandleFunc("/", foo)
1649
http.HandleFunc("/about", bar)
50+
http.HandleFunc("/contact/2", con2)
51+
http.HandleFunc("/contact/3", con3)
52+
http.HandleFunc("/contact/4", con4)
1753
http.ListenAndServe(":8080", nil)
1854
}
1955

@@ -24,3 +60,17 @@ func foo(w http.ResponseWriter, r *http.Request) {
2460
func bar(w http.ResponseWriter, r *http.Request) {
2561
tpl.ExecuteTemplate(w, "about.gohtml", nil)
2662
}
63+
64+
func con2(w http.ResponseWriter, r *http.Request) {
65+
tpl2.ExecuteTemplate(w, "contact.gohtml", nil)
66+
}
67+
68+
69+
func con3(w http.ResponseWriter, r *http.Request) {
70+
tpl3.ExecuteTemplate(w, "contact.gohtml", nil)
71+
}
72+
73+
74+
func con4(w http.ResponseWriter, r *http.Request) {
75+
tpl4.ExecuteTemplate(w, "pale", nil)
76+
}

000_temp/75/templates/about.gohtml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

1414
<a href="/">HOME</a>
1515
<a href="/about">ABOUT</a>
16+
<a href="/contact/2">CONTACT 2</a>
17+
<a href="/contact/3">CONTACT 3</a>
18+
<a href="/contact/4">CONTACT 4</a>
19+
20+
1621

1722
</body>
1823
</html>

000_temp/75/templates/contact.gohtml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport"
6+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>HOME</title>
9+
</head>
10+
<body>
11+
12+
<h1>YOU ARE AT CONTACT</h1>
13+
14+
<a href="/">HOME</a>
15+
<a href="/about">ABOUT</a>
16+
<a href="/contact/2">CONTACT 2</a>
17+
<a href="/contact/3">CONTACT 3</a>
18+
<a href="/contact/4">CONTACT 4</a>
19+
20+
</body>
21+
</html>

000_temp/75/templates/index.gohtml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
<a href="/">HOME</a>
1515
<a href="/about">ABOUT</a>
16+
<a href="/contact/2">CONTACT 2</a>
17+
<a href="/contact/3">CONTACT 3</a>
18+
<a href="/contact/4">CONTACT 4</a>
19+
1620

1721
</body>
1822
</html>

0 commit comments

Comments
 (0)