Im trying to serve a react-router with go, i already did it, but i'm having troubles, i think the way i did is not the correct one, or it's not complete. Im using Mux. The trouble im having is that when i push the <Link>
's in my app it changes de view correctly, but when i try to change it directly from the browser or i try to reload the page i get a 404 error
I've tried diferent ways, im actually doing this way:
func main() {
var dir = "./static"
router := mux.NewRouter()
fs := http.FileServer(http.Dir(dir))
router.PathPrefix("/").Handler(fs)
fmt.Println("Server running in port :8000")
log.Fatal(http.ListenAndServe(":8000", router))
}
I want the server to serve the same directory in all request like "/", "/example", "/example2", etc.