You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now if you visit http://localhost:8000/your/custom/route/about it will render /resources/js/Pages/path/to/component/about.vue (or react or svelte). All components that you create inside /resources/js/Pages/path/to/component/ will be automatically bind to a route like http://localhost:8000/your/custom/route/{component_name} 🤯.
66
+
## Bind folder
29
67
30
-
Want to serve components from your root domain?
68
+
Bind all components inside a folder:
31
69
32
70
```php
33
-
InertiaRoute::bind('/', 'components/folder/');
71
+
InertiaRoute::bind('some/folder/');
34
72
```
35
73
36
-
**IMPORTANT!** InertiaRoute::bind use a "catch all" strategy, so put this route at the end of your route file or group.
It's posible that this package works with older versions of PHP, Laravel or Inertia, but I don't have time to test it. If you try, please let me know 🙌.
96
+
**IMPORTANT!** InertiaRoute::bind use a "catch all" strategy, so put this route at the end of your route file or group.
51
97
52
-
##What about parameters
98
+
### Parameters
53
99
54
100
If you want to use route paramaters(without any backend proccess) you could define a route like this:
/resources/js/Pages/components/folder/hola.vue (react or svelte)
125
-
```
126
-
127
-
nice, right? 😎
128
147
129
-
## what if there is no component?
148
+
## 404
130
149
131
150
InertiaRoute verifies if the file exist before try to render it. In case you want to access a non existing component, it will display a 404 page.
132
151
133
-
## I prefer Svelte or React
152
+
## Svelte or React
134
153
135
-
Yeah, me too (svelte simp here 🙊). By default InertiaRoute will render Vue files, so in most cases you don't need to do anything. But, if you are working with React or Svelte, you could easily switch to those frameworks.
154
+
By default InertiaRoute will render Vue files. But, if you are working with React or Svelte, you could easily switch to those frameworks.
Remember to change framework before declare routes.
174
171
175
-
## I don't use /resources/js/Pages
172
+
## Change root path
176
173
177
-
Inertiajs suggests this folder in its installation guide, however, you may be use another folder. If that is the case, you can change your root folder with:
174
+
Inertiajs suggests resources/js/Pages as default folder, however, you may be use another path. If that is the case, you can change your root folder with:
0 commit comments