Skip to content
Discussion options

You must be logged in to vote

Here is the documentation regarding the RequestEvent interface that is available to load functions in +page.server.js, endpoints in +server.js, and handle in +hooks.server.js, etc.

https://kit.svelte.dev/docs/types#public-types-requestevent

It will look something like this:

export const load = ({ cookies, fetch, locals, params, request, setHeaders }) => {
  // ...
}

Only the endpoint in +server.js and handle in +hooks.server.js can return a Response object.

https://kit.svelte.dev/docs/hooks#server-hooks-handle

You could modify the final response in +hooks.server.js or return a custom response.

export const handle = async ({ event, resolve }) => {
  // resolve will call the correct load fu…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@magic-thomas
Comment options

Answer selected by magic-thomas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants