Skip to content

Commit c17522a

Browse files
committed
you're doing great
1 parent a343788 commit c17522a

File tree

4 files changed

+127
-0
lines changed

4 files changed

+127
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
)
7+
8+
func main() {
9+
fmt.Println("Are you human?")
10+
fmt.Println("YES or NO")
11+
var answer string
12+
_, err := fmt.Scanf("%s", &answer)
13+
if err != nil {
14+
panic(err)
15+
}
16+
if answer != "YES" {
17+
fmt.Println("You're not human! What?!?!")
18+
os.Exit(0)
19+
}
20+
fmt.Println("I am glad you are human")
21+
}

000_temp/46_sp17/11/main.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package main
2+
3+
import (
4+
"net/http"
5+
"fmt"
6+
)
7+
8+
func main() {
9+
http.HandleFunc("/", foo)
10+
http.ListenAndServe(":8080", nil)
11+
}
12+
13+
func foo(w http.ResponseWriter, r *http.Request) {
14+
fmt.Fprint(w, "Hello from foo")
15+
}

000_temp/46_sp17/12/main.go

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package main
2+
3+
import (
4+
"net/http"
5+
"fmt"
6+
)
7+
8+
func main() {
9+
http.HandleFunc("/", index)
10+
http.HandleFunc("/about", about)
11+
http.HandleFunc("/contact", contact)
12+
http.ListenAndServe(":8080", nil)
13+
}
14+
15+
func index(w http.ResponseWriter, r *http.Request) {
16+
fmt.Fprint(w, `<!DOCTYPE html>
17+
<html lang="en">
18+
<head>
19+
<meta charset="UTF-8">
20+
<title>index</title>
21+
<style>
22+
html {
23+
font-size: 48px;
24+
}
25+
</style>
26+
</head>
27+
<body>
28+
Hello from index
29+
<br><br>
30+
<a href="/">index</a>
31+
<a href="/about">about</a>
32+
<a href="/contact">contact</a>
33+
</body>
34+
</html>`)
35+
}
36+
37+
38+
func about(w http.ResponseWriter, r *http.Request) {
39+
fmt.Fprint(w, `<!DOCTYPE html>
40+
<html lang="en">
41+
<head>
42+
<meta charset="UTF-8">
43+
<title>about</title>
44+
<style>
45+
html {
46+
font-size: 48px;
47+
}
48+
</style>
49+
</head>
50+
<body>
51+
Hello from about
52+
<br><br>
53+
<a href="/">index</a>
54+
<a href="/about">about</a>
55+
<a href="/contact">contact</a>
56+
</body>
57+
</html>`)
58+
}
59+
60+
61+
func contact(w http.ResponseWriter, r *http.Request) {
62+
fmt.Fprint(w, `<!DOCTYPE html>
63+
<html lang="en">
64+
<head>
65+
<meta charset="UTF-8">
66+
<title>contact</title>
67+
<style>
68+
html {
69+
font-size: 48px;
70+
}
71+
</style>
72+
</head>
73+
<body>
74+
Hello from contact
75+
<br><br>
76+
<a href="/">index</a>
77+
<a href="/about">about</a>
78+
<a href="/contact">contact</a>
79+
</body>
80+
</html>`)
81+
}

000_temp/46_sp17/12/temp.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
</head>
7+
<body>
8+
9+
</body>
10+
</html>

0 commit comments

Comments
 (0)