blob: ce4bb9ff43c81bbd01a6762fd162bb1aec9a88fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package main
import (
"net/http"
)
func main() {
// serve the index page
http.Handle("/", http.FileServer(http.Dir("./static")))
// serve the contact page
http.HandleFunc("/contact/", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "static/contact.html")
})
// server the static css
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
// start listening to incomming connections and serve the appropriate files
panic(http.ListenAndServe(":80", nil))
}
|