-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Is your feature request related to a problem? Please describe.
I'm trying to organise each route in my sveltekit app with each .svelte route fetching their data from a corresponding .json.js exportint a get() function.
It's all working nicely, until I've had to create a route with a terminal rest parameter:
routes
-- concepts
---- [...conceptPath].svelte
Sveltekit was pretty happy with the rest path for the .svelte route. However, it rejected a [...conceptPath].json.js with:
rest parameter must be a standalone segment
It seems happy with the rest parameter set as a folder, though:
routes
-- concepts
---- [...conceptPath]
------- index.json.js
------- index.svelte
While this works, it'll lead to a good deal of index.svelte/index.json files
Wrote a bit soon regarding the above structure working, the server seems to favour the index.json.js route over the index.svelte, and I'm getting JSON instead of HTML.
This was circumvented again with setting the .json.js to a different path than index.
-- concepts
---- [...conceptPath]
------ load.json.js
------ index.svelte
It makes the delegation from the .svelte file to .json.js a little less generic.
Describe the solution you'd like
It'd be great to be able to declare endpoints with rest parameters. If there's a technical limitation to it, though, having the situation highlighted in the documentation would work too.
Describe alternatives you've considered
Placing the rest parameter as a folder provides a workaround.
How important is this feature to you?
It's more a mild annoyance than anything as there's a workaround. Having some clarification in the documentation could help people wonder why their route is rejected though.