about summary refs log tree commit diff
path: root/src/main.go
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-02-25 23:56:29 +0100
committerEmile <hanemile@protonmail.com>2019-02-25 23:56:29 +0100
commit23ecf18de76e8ef873acac89923232987366c7a9 (patch)
treeeb890f3ab55ebaf84e1f4f494b723985168c4454 /src/main.go
parentde59393dbd2043611de91f0612626bc858256d19 (diff)
updated the file structure
Diffstat (limited to 'src/main.go')
-rw-r--r--src/main.go20
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))
 }