kit icon indicating copy to clipboard operation
kit copied to clipboard

add routing.js to exports to create custom routing

Open mavdotj opened this issue 2 years ago • 7 comments

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

mavdotj avatar Dec 18 '22 22:12 mavdotj

I think there was an issue about extracting the router into its own package. That could solve your issue.

david-plugge avatar Dec 18 '22 22:12 david-plugge

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?

dummdidumm avatar Dec 19 '22 09:12 dummdidumm

I mean custom routing files as in my own _hooks.ts files for creating per page hooks. (https://github.com/sveltejs/kit/discussions/8007)

mavdotj avatar Dec 19 '22 20:12 mavdotj

@dummdidumm

mavdotj avatar Dec 19 '22 20:12 mavdotj

I still have no idea what this feature request is. Please explain it in simple, concrete terms, ideally with specific examples.

Rich-Harris avatar Jan 06 '23 03:01 Rich-Harris

@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

mavdotj avatar Jan 09 '23 12:01 mavdotj

But why? I'm talking about ends, not means.

Rich-Harris avatar Jan 09 '23 17:01 Rich-Harris

closing this as there's nothing actionable

Rich-Harris avatar Jan 28 '23 01:01 Rich-Harris