Skip to content

Commit 5f2ffc1

Browse files
saihajdotansimha
andauthored
cf modules e2e test (#1814)
* trying * fixes * trigger ci Co-authored-by: Dotan Simha <[email protected]>
1 parent d031e7a commit 5f2ffc1

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

e2e/tests/create-cf-deployment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function createCFDeployment(
5252
'utf-8',
5353
),
5454
module: isModule,
55-
secretTextBindings: [
55+
plainTextBindings: [
5656
{
5757
name: 'GRAPHQL_ROUTE',
5858
text: `/${stackName}`,
Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
// src/index.mjs
22
import { createYoga, createSchema } from 'graphql-yoga'
33

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',
1813
},
19-
}),
14+
},
2015
})
2116

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+
}

0 commit comments

Comments
 (0)