kit
kit copied to clipboard
add routing.js to exports to create custom routing
Describe the problem
I've always wanted to make my own custom routing files but frustrated when I cant import the utils/routing.js from sveltekit and I have to implement my own route to regex method or copy the code and add it to my own code whenever the original file updates.`
Describe the proposed solution
Export all files in utils folder
Alternatives considered
Just export utils/routing.js as './routing'
Importance
would make my life easier
Additional Information
No response
I think there was an issue about extracting the router into its own package. That could solve your issue.
I don't fully understand the feature request. What do you my by "my own custom routing files"? Do you want to opt out of the file-system based routing and have the ability to configure what routes load at which point yourself manually through some configuration file?
I mean custom routing files as in my own _hooks.ts files for creating per page hooks. (https://github.com/sveltejs/kit/discussions/8007)
@dummdidumm
I still have no idea what this feature request is. Please explain it in simple, concrete terms, ideally with specific examples.
@Rich-Harris I want to be able to use the functions exported by routing.js so that I can parse routes the same way that sveltekit does. In this case, I want to import all files in my routes folder named _hooks.ts/js, then use parse_route_id from routing.js and create a list of hooks, import them in hooks.server.ts and check if the URL matches the Regex using exec
But why? I'm talking about ends, not means.
closing this as there's nothing actionable