fix stylesheet

main
sandyx 1 year ago
parent ba3e9ba80c
commit 19af2a1cc8

@ -66,15 +66,12 @@ func main() {
for _, e := range entries {
new := e.Name()
if new == "style.css" { continue }
http.HandleFunc("/" + url.QueryEscape(new), func(w http.ResponseWriter, r *http.Request) {
log.Println("Request for resource: ", r.RequestURI)
//could also generate the css at runtime
if r.RequestURI == "/style.css" {
serveStylesheet(w, r)
return
}
file, err := os.Open(*directory + "/" + new)
if err != nil {
http.Error(w, "File not found.", http.StatusNotFound)
@ -121,6 +118,7 @@ func main() {
}
http.Handle("/", http.HandlerFunc(handler))
http.Handle("/style.css", http.HandlerFunc(serveStylesheet))
log.Printf("Serving %s on HTTP port: %s\n", *directory, *port)
log.Fatal(http.ListenAndServe(":"+*port, nil))
}

Loading…
Cancel
Save