Add FAQ Page
This commit is contained in:
parent
34df46e0d5
commit
2d2bea6543
13
main.go
13
main.go
@ -13,6 +13,17 @@ func contactHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Header().Set("Content-Type", "text/html; charset=utf8")
|
w.Header().Set("Content-Type", "text/html; charset=utf8")
|
||||||
fmt.Fprint(w, "<h1>Contact Page</h1><p>To get in touch, email me at <a href=\"mailto:example@example.com\">example@example.com</a></p>")
|
fmt.Fprint(w, "<h1>Contact Page</h1><p>To get in touch, email me at <a href=\"mailto:example@example.com\">example@example.com</a></p>")
|
||||||
}
|
}
|
||||||
|
func faqHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Content-Type", "text/html; charset=utf8")
|
||||||
|
fmt.Fprint(w, `
|
||||||
|
<h1>FAQ</h1>
|
||||||
|
<hr>
|
||||||
|
<h3>Is this a real website?</h3>
|
||||||
|
<p>No.</p>
|
||||||
|
<h3>I Can Has Cheezburger?</h3>
|
||||||
|
<p>No.</p>
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
type Router struct{}
|
type Router struct{}
|
||||||
|
|
||||||
@ -22,6 +33,8 @@ func (router Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
homeHandler(w, r)
|
homeHandler(w, r)
|
||||||
case "/contact":
|
case "/contact":
|
||||||
contactHandler(w, r)
|
contactHandler(w, r)
|
||||||
|
case "/faq":
|
||||||
|
faqHandler(w, r)
|
||||||
default:
|
default:
|
||||||
w.Header().Set("Content-Type", "text/html; charset=utf8")
|
w.Header().Set("Content-Type", "text/html; charset=utf8")
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user