diff --git a/main.go b/main.go index 37003ef..627ed98 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "net/http" "strings" ) @@ -10,19 +9,14 @@ var currentConfig config func handleRequest(w http.ResponseWriter, r *http.Request) { path := r.URL.Path - switch r.Method { - case "GET": - if path == "/" { - http.ServeFile(w, r, "./static/index.html") + if path == "/" { + http.ServeFile(w, r, "./static/index.html") - } else if strings.HasPrefix(path, "/static/") { - fs := http.FileServer(http.Dir("./static")) - http.Handle("/static/", http.StripPrefix("/static/", fs)) - } else { - w.WriteHeader(http.StatusNotFound) - } - case "POST": - fmt.Println("Post!") + } else if strings.HasPrefix(path, "/static/") { + fs := http.FileServer(http.Dir("./static")) + http.Handle("/static/", http.StripPrefix("/static/", fs)) + } else { + w.WriteHeader(http.StatusNotFound) } } @@ -34,6 +28,6 @@ func main() { err := http.ListenAndServe(listen, nil) if err != nil { - fmt.Println(err) + return } }