An attempt to configure go server routing with github.com/gorilla/mux
to respond to all requests with index.html but exclude requests with extension .jpg|.js|.png
Static files excluded due to extension will be routed to FileServer. configured.
Failed Attempt
func main() {
r := mux.NewRouter()
r.HandleFunc("/{path:^.*([!js|jpg|png|gif])$}", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "dist/index.html")
})
r.PathPrefix("/").Handler(http.StripPrefix("/", http.FileServer(http.Dir("dist"))))
http.Handle("/", r)
http.ListenAndServe(":8000", nil)
}