File tree Expand file tree Collapse file tree 2 files changed +22
-17
lines changed
examples/cloudflare-modules/src Expand file tree Collapse file tree 2 files changed +22
-17
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export function createCFDeployment(
52
52
'utf-8' ,
53
53
) ,
54
54
module : isModule ,
55
- secretTextBindings : [
55
+ plainTextBindings : [
56
56
{
57
57
name : 'GRAPHQL_ROUTE' ,
58
58
text : `/${ stackName } ` ,
Original file line number Diff line number Diff line change 1
1
// src/index.mjs
2
2
import { createYoga , createSchema } from 'graphql-yoga'
3
3
4
- const { fetch } = createYoga ( {
5
- graphqlEndpoint : '/graphql' ,
6
- landingPage : false ,
7
- schema : createSchema ( {
8
- typeDefs : /* GraphQL */ `
9
- type Query {
10
- greetings: String
11
- }
12
- ` ,
13
- resolvers : {
14
- Query : {
15
- greetings : ( ) =>
16
- 'This is the `greetings` field of the root `Query` type' ,
17
- } ,
4
+ const schema = createSchema ( {
5
+ typeDefs : /* GraphQL */ `
6
+ type Query {
7
+ greetings: String
8
+ }
9
+ ` ,
10
+ resolvers : {
11
+ Query : {
12
+ greetings : ( ) => 'This is the `greetings` field of the root `Query` type' ,
18
13
} ,
19
- } ) ,
14
+ } ,
20
15
} )
21
16
22
- export default { fetch }
17
+ export default {
18
+ fetch ( request : Request , env : { [ key : string ] : string } ) {
19
+ const yoga = createYoga ( {
20
+ graphqlEndpoint : env . GRAPHQL_ROUTE || '/graphql' ,
21
+ landingPage : false ,
22
+ schema,
23
+ } )
24
+
25
+ return yoga . fetch ( request )
26
+ } ,
27
+ }
You can’t perform that action at this time.
0 commit comments