-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
executable file
·45 lines (43 loc) · 922 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import ("net/http" ; "io")
func hello(res http.ResponseWriter, req *http.Request) {
res.Header().Set(
"Content-Type",
"text/html",
)
io.WriteString(
res,
`<!doctype html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
Hello World!
</body>
</html>`,
)
}
func omg(res http.ResponseWriter, req *http.Request) {
res.Header().Set(
"Content-Type",
"text/html",
)
io.WriteString(
res,
`<!doctype html>
<html>
<head>
<title>OMG!</title>
</head>
<body>
OMG! It work's!
</body>
</html>`,
)
}
func main() {
http.HandleFunc("/hello", hello)
http.HandleFunc("/omg", omg)
http.ListenAndServe(":8080", nil)
}