Skip to content
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

Running Router On a Specific Path with Hash Routing #690

Open
AcidLeroy opened this issue Nov 5, 2018 · 3 comments
Open

Running Router On a Specific Path with Hash Routing #690

AcidLeroy opened this issue Nov 5, 2018 · 3 comments

Comments

@AcidLeroy
Copy link

This is more of a help wanted issue. The problem that I am having is that I am attempting to put a choo.js app that is not on the root path of site, i.e. mysite.com/#userid. Instead, I am attempting to run the site on mysite.com/biz/baz/myapp/#userid. What do I need to do, assuming I don't have server control, to get my hash routes to work on an arbitrary root location on the path?

I've tried the following and this didn't work for me:

const prefix = '/biz/baz/myapp'
app.route(prefix+'/', welcome)
app.route(prefix+'#:userid', user)

Is there a trick that I need to do in order to stick my choo app on a subregion of mysite?

Thanks!

@azappella
Copy link

Check this issue for more information: #666

@bennlich
Copy link

I'm having the same problem. I'd love it if my choo routes were interpreted to be relative to the directory from which the app is served (as opposed to the domain root), but I can't figure out how to do this.

@bennlich
Copy link

@AcidLeroy If you are comfortable putting the path prefix you deploy to in your code, I was able to get your scenario to work like so:

let app = choo({ hash: true });
app.route('/some/path', mainView);
app.route('/some/path/users/:user_id', userView);

But I'd love it if someone could help me get this to work without including the deployment path in the source of the app. I.e. using paths relative to the deployment path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants