-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
hooks.server.ts
40 lines (35 loc) · 904 Bytes
/
hooks.server.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { dev } from '$app/environment'
import { kitqlServer, type IKitQLContext } from '$lib/graphql/kitQLServer'
import { handleGraphiql } from '$lib/hooks/graphiql'
import { handleGraphql } from '$lib/hooks/graphql'
import { sequence } from '@sveltejs/kit/hooks'
/**
* 1/ With all default options
*/
export const handle = sequence(
// create the graphql endpoint
handleGraphql<IKitQLContext>(kitqlServer),
// enable graphiql in dev mode
handleGraphiql({
enabled: dev,
})
)
/**
* 2/ With custom options
*/
// const endpoint = '/graphql'
// const graphiQLPath = '/graphiql'
// export const handle = sequence(
// // create the graphql endpoint
// handleGraphql<IKitQLContext>({
// endpoint,
// graphiQLPath,
// ...kitqlServer,
// }),
// // enable graphiql in dev mode
// handleGraphiql({
// enabled: dev,
// endpoint,
// graphiQLPath,
// })
// )