-
Notifications
You must be signed in to change notification settings - Fork 583
cf modules e2e test #1814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cf modules e2e test #1814
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
// src/index.mjs | ||
import { createYoga, createSchema } from 'graphql-yoga' | ||
|
||
const { fetch } = createYoga({ | ||
graphqlEndpoint: '/graphql', | ||
landingPage: false, | ||
schema: createSchema({ | ||
typeDefs: /* GraphQL */ ` | ||
type Query { | ||
greetings: String | ||
} | ||
`, | ||
resolvers: { | ||
Query: { | ||
greetings: () => | ||
'This is the `greetings` field of the root `Query` type', | ||
}, | ||
const schema = createSchema({ | ||
typeDefs: /* GraphQL */ ` | ||
type Query { | ||
greetings: String | ||
} | ||
`, | ||
resolvers: { | ||
Query: { | ||
greetings: () => 'This is the `greetings` field of the root `Query` type', | ||
}, | ||
}), | ||
}, | ||
}) | ||
|
||
export default { fetch } | ||
export default { | ||
fetch(request: Request, env: { [key: string]: string }) { | ||
const yoga = createYoga({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe remove the parameter and modify the bundled code inside the deployment script; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like it's too tricky... see my other comments on why we need this setup There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this is also our example for CF Modules and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, so let's move on with this PR as-is. Then, we'll open an issue to improve the setup. We'll need to experiment with using the router config that includes |
||
graphqlEndpoint: env.GRAPHQL_ROUTE || '/graphql', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, CF module Worker doesn't use the globals for env vars, only through the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of adding those extra options to our example, we can make it work by modifying the bundle like here; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we can do that too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the tricky part of it is just that is mutates the code example |
||
landingPage: false, | ||
schema, | ||
}) | ||
|
||
return yoga.fetch(request) | ||
}, | ||
} |
Uh oh!
There was an error while loading. Please reload this page.