Can someone explain to me why the first line of code delivers the desired result and the second piece of code returns 404? In the browser I searched localhost/ and localhost/css respectively.
1. http.Handle("/", http.FileServer(http.Dir("css"))) // works
2. http.Handle("/css", http.FileServer(http.Dir("css"))) // fails
I am not trying to serve both URLs at the same time. I comment out one or the other while I am trying to figure this out.
I solved the problem. The code below returned my css at the desired URL.
http.Handle("/css/", http.StripPrefix("/css/", http.FileServer(http.Dir("css))))
What's odd is I could have sworn I tried this method. Must be something delaying the refresh of chrome.