ruby - Sinatra and a client-side routing -
i have simple application (server side sinatra, client side reactjs).
the workflow basic: sinatra handles get "/" request , sends index.html client static stylesheet , scripts.
scripts reactjs app consists of several components , reactrouter. each react's component distinct "page" own route/path in terms of reactrouter.
for example:
"/" => "index.html" (real html page renered components inside),"/form" => (reactrouter points component <form/>, in fact render happens inside selector of "index.html"),"/finish" => (reactrouter points component <finish/>, in fact render happens inside selector of "index.html").
while implementing client side only, worked pretty well. now, when trying use sinatra server side stuff broken: when want go /form getting sinatra's default 404 page ("sinatra doesn’t know ditty.").
i understand sinatra (or rack) intercepts request's path (/form of /finish) before reactrouter. cannot understand how fix (and why so, while router script on client , should fire first).
thanks help.
use wildcard route return index.html route.
something this:
get '/*' #return index.html end
Comments
Post a Comment