-
Notifications
You must be signed in to change notification settings - Fork 31
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
Deploy in subdirectory? #88
Comments
Right now it should work if you will use full path in links and Routes: <a href="/app1/route1">Route1</a>
<a href="/app1/route2">Route2</a>
<Route path="/app1/*">
<Route path="/route1">This is route #1</Route>
<Route path="/route2">This is route #2</Route>
</Route> Course you can use constant to define base: <script>
import {BASE} from './my_constants.js'; // BASE='/app1';
</script>
<a href="{BASE}/route1">Route1</a>
<a href="{BASE}/route2">Route2</a>
<Route path="{BASE}/*">
<Route path="/route1">This is route #1</Route>
<Route path="/route2">This is route #2</Route>
</Route> But I'll try to implement more explicit base defining. It will be something like this in near future: <script>
import {router} from 'tinro';
router.setBase('app1');
</script>
<a href="/route1">Route1</a>
<a href="/route2">Route2</a>
<Route>
<Route path="/route1">This is route #1</Route>
<Route path="/route2">This is route #2</Route>
</Route> |
Hi,
thanks for the response!
My goal was to keep the app itself totally agnostic of where it is deployed, and just operate on local paths completely. Do you think that is feasible or is there fundamental blocker?
…On 3. Sep 2021, 12:28 +0200, Alexey Schebelev ***@***.***>, wrote:
Right now it should work if you will use full path in links and Routes:
<a href="/app1/route1">Route1</a>
<a href="/app1/route2">Route2</a>
<Route path="/app1/*>
<Route path="/route1>This is route #1</Route>
<Route path="/route2>This is route #2</Route>
</Route>
Course you can use constant to define base:
<script>
import {BASE} from './my_constants.js'; // BASE='/app1';
</script>
<a href="{BASE}/route1">Route1</a>
<a href="{BASE}/route2">Route2</a>
<Route path="{BASE}/*>
<Route path="/route1>This is route #1</Route>
<Route path="/route2>This is route #2</Route>
</Route>
But I'll try to implement more explicit base defining. It will be something like this in near future:
<script>
import {router} from 'tinro';
router.setBase('app1');
</script>
<a href="/route1">Route1</a>
<a href="/route2">Route2</a>
<Route>
<Route path="/route1>This is route #1</Route>
<Route path="/route2>This is route #2</Route>
</Route>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
(I just noticed that enabling hash navigation using |
I added method |
It is impossible to determine that app is under subdirectory when using history API. All routers have config option to set base path. |
Makes sense, and thanks for the quick help! |
Hi,
thanks for this handy router.
I have a scenario where I want to deploy a svelte app in a subdirectory on a server, e.g. example.com/app1/ example.com/app2/.
How would I configure tinro to manage routes only under inside their own path? (e.g. /app1/route1). I tried relative paths, but this didn't seem to trigger the routes.
Thank you for any pointers!
The text was updated successfully, but these errors were encountered: