diff --git a/main.go b/main.go index 957373c..53488c9 100644 --- a/main.go +++ b/main.go @@ -5,13 +5,18 @@ import ( "net/http" ) -func handlerFunc(w http.ResponseWriter, r *http.Request) { +func homeHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf8") fmt.Fprint(w, "

Welcome to my awesome site!

") } +func contactHandler(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/html; charset=utf8") + fmt.Fprint(w, "

Contact Page

To get in touch, email me at example@example.com

") +} func main() { - http.HandleFunc("/", handlerFunc) + http.HandleFunc("/", homeHandler) + http.HandleFunc("/contact", contactHandler) fmt.Println("Starting the server on :3000...") http.ListenAndServe(":3000", nil) }