-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
43 lines (39 loc) · 1009 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
package main
import (
"log"
"net/http"
"io/ioutil"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Header().Add("content-type", "text/html")
dat, err := ioutil.ReadFile("404.html")
if err != nil {
w.Write(([]byte)("502 bad gateway"))
} else {
w.Write(dat)
}
})
http.HandleFunc("/logo.png", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Header().Add("content-type", "image/png")
dat, err := ioutil.ReadFile("logo.png")
if err != nil {
w.Write(([]byte)("502 bad gateway"))
} else {
w.Write(dat)
}
})
http.HandleFunc("/proximanova.woff", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Header().Add("content-type", "application/font-woff")
dat, err := ioutil.ReadFile("proximanova.woff")
if err != nil {
w.Write(([]byte)("502 bad gateway"))
} else {
w.Write(dat)
}
})
log.Fatal(http.ListenAndServe(":9000", nil))
}