diff options
Diffstat (limited to 'src/main.go')
-rw-r--r-- | src/main.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main.go b/src/main.go index 0808608..ce4bb9f 100644 --- a/src/main.go +++ b/src/main.go @@ -1,7 +1,23 @@ package main -import "net/http" +import ( + "net/http" +) + func main() { - panic(http.ListenAndServe(":80", http.FileServer(http.Dir("./")))) + + // 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)) } |