package static import ( "net/http" "strings" ) func (s Static) StaticRoute(w http.ResponseWriter, r *http.Request) { f, err := s.FS.ReadFile(s.prefix + r.PathValue("filename")) if strings.HasSuffix(r.URL.Path, ".css") { w.Header().Set("Content-Type", "text/css") } if err != nil { Err404(w, r) return } w.Write(f) }