-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mounting on a sub-path #14
Comments
@tnguyen14 heya! - this sounds similar to what @finnp was running into recently. There was a clever workaround which I forgot, but something simple would be: var base = process.env.NODE_ENV === 'production' ? '/projectname' : ''
var app = choo()
app.route(`${base}/foo`, fooView) Does this make sense? |
@yoshuawuyts Thanks. I just tried this, but I am still seeing Route not found error. |
After trying out a few different configurations, I figured out that app.route(`${base}`, mainView) works, but app.route(`${base}/`, mainView) does not. Not sure why, perhaps with the way the path matches. The app's URL does contain the ending url, i.e. |
tldr: "/" signifies the root but also the lack of a route. the navigator events a github project named
will work without the prepended slash. Additionally,
This has symmetry with the navigator route events. so on localhost so if root = "/" on localhost
and root = "foo" on github-pages,
So let me outline the problem as I see it
app.mount('myRepo', mainView)
app.mount('myRepo/bar', barView)
app.mount(getBase(), mainView)
app.mount(path.join(getBase(), "bar"), barView) where function getBase () { return "" } // on localhost
function getBase() { return "myRepo" } // on deployed github app
function getBaseStateRoute () { return "/" } // on localhost
function getBaseStateRoute() { return "myRepo" } // on deployed github app I think this is a small issue, but I wanted to present what I found. I think its worth exploring the idea if the state.route on the root of localhost could be |
When trying to use choo on a static site hosted by Github pages, the app lives on a subpath (like
https://tnguyen14.github.io/projectname/my-app
. This is breaking the router, as it doesn't match the route that I define in the app (which assumes the app lives at the root domain).Is there a way to take this into account?
/cc @yoshuawuyts
The text was updated successfully, but these errors were encountered: