paypal / react-engine

a composite render engine for universal (isomorphic) express apps to render both plain react views and react-router views
Apache License 2.0
1.45k stars 130 forks source link

How can a basename be set for your example app? (browserHistory) #178

Open Richacinas opened 7 years ago

Richacinas commented 7 years ago

I was wondering how could we set a basename for this application. It is a normal usage to have the project hosted on a folder inside our virtual host.

Something like this:

const browserHistory = useRouterHistory(createHistory)({
    basename: '/project-folder'
});

being passed to our Router, is causing an error like:

Error: Invariant Violation: Browser history needs a DOM

Anybody could explain how to properly set up a baseurl so client side and server side routing works the same way?

samsel commented 7 years ago

@Richacinas base url as in similar to mount path in express?

Richacinas commented 7 years ago

@samsel I'm not sure, I searched a little bit and don't really know how to answer to your question. I'm talking about the classic base url that we set up on a project so when we access to a path relative to root on links, scripts, statics... it prepends that base url to '/'