Replies: 2 comments
-
This sounds a bit like #4274 |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm a newbie here--having one top-level hook endpoint is a bit limiting than having route-based hooks. One obvious application is authentication--some parts of the app need authentication, or have role restrictions, and other parts are public. Maybe a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I don't know if this fits withing the scope of the project but having hooks as a top thing that happens before calling your endpoint feels a bit limiting. The idea here is to have a
__hook.ts
file wich has ahandle()
just like the normal hooks file, I think this way would be more flexible and granular how we control our endpoints.When we call
fetch('api/private/sub_private')
every__hook.ts
that's before the endpoint in the routes tree would be called in order and for example if there is some auth or role based authorization verfication it can be done closer to the endpoint call.I don't know if this is too much like an express middleware model or if this could fit well within sveltekit, but it's an idea that I had on my mind for a while.
Beta Was this translation helpful? Give feedback.
All reactions