diff --git a/main.go b/main.go index 3833cc4..02a11c0 100644 --- a/main.go +++ b/main.go @@ -14,9 +14,7 @@ func contactHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "

Contact Page

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

") } -type Router struct{} - -func (router Router) ServeHTTP(w http.ResponseWriter, r *http.Request) { +var pathHandler http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case "/": homeHandler(w, r) @@ -31,7 +29,6 @@ func (router Router) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func main() { - var router Router fmt.Println("Starting the server on :3000...") - http.ListenAndServe(":3000", router) + http.ListenAndServe(":3000", pathHandler) }