Im chaning my application architecture and moving from server routing with spark to client routing with react. for that purpose I want my server to return my /build/ as a static folder, and let react-router handle the rest

my problem is that the returned URL is www.dummy.com/static/index.html instead of www.dummy.com.

when react router joins to the party, it changes the url to www.dummy.com/static/index.html#/login, www.dummy.com/static/index.html#/dashboard etc..

can I get rid of the /static/index.html in the url?

im currently using Spark.externalStaticFileLocation("public/build", "/static") in the server,

and then redirecting to index.html

Spark.get("/", (req, res) -> {
   res.redirect("/static/index.html");
   return ""
}

thanks!

0 Answers