Prompt Backend

Add SvelteKit Hooks

Implement SvelteKit hooks for auth, logging, or request transformation.

sveltesveltekit
Insert label Add Hooks
Prompt

Add a SvelteKit hook in src/hooks.server.ts. Implement the handle function to intercept requests — for auth checks, adding headers, logging, or redirecting. Use sequence() if combining multiple hooks. Type the event.locals interface in app.d.ts for any data passed to routes.

Add this to your Facet Inserts in Crystl for one-click access.

Get Crystl