Skip to content

Commit 5faf8c5

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

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

000_temp/75/main.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package main
2+
3+
import (
4+
"html/template"
5+
"net/http"
6+
)
7+
8+
var tpl = template.New("pale")
9+
10+
func init() {
11+
tpl = template.Must(template.ParseGlob("templates/*.gohtml"))
12+
}
13+
14+
func main() {
15+
http.HandleFunc("/", foo)
16+
http.HandleFunc("/about", bar)
17+
http.ListenAndServe(":8080", nil)
18+
}
19+
20+
func foo(w http.ResponseWriter, r *http.Request) {
21+
tpl.ExecuteTemplate(w, "index.gohtml", nil)
22+
}
23+
24+
func bar(w http.ResponseWriter, r *http.Request) {
25+
tpl.ExecuteTemplate(w, "about.gohtml", nil)
26+
}

000_temp/75/templates/about.gohtml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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>ABOUT</title>
9+
</head>
10+
<body>
11+
12+
<h1>YOU ARE AT ABOUT</h1>
13+
14+
<a href="/">HOME</a>
15+
<a href="/about">ABOUT</a>
16+
17+
</body>
18+
</html>

000_temp/75/templates/index.gohtml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 HOME</h1>
13+
14+
<a href="/">HOME</a>
15+
<a href="/about">ABOUT</a>
16+
17+
</body>
18+
</html>

0 commit comments

Comments
 (0)