Skip to content
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

examples(with-routes-graphql): update GraphQL Yoga to v3 #41478

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/api-routes-graphql/package.json
Expand Up @@ -6,7 +6,7 @@
"start": "next start"
},
"dependencies": {
"@graphql-yoga/node": "^2.11.2",
"graphql-yoga": "three",
"graphql": "^16.5.0",
"next": "latest",
"react": "^18.2.0",
Expand Down
18 changes: 9 additions & 9 deletions examples/api-routes-graphql/pages/api/graphql.ts
@@ -1,4 +1,4 @@
import { createServer } from '@graphql-yoga/node'
import { createYoga, createSchema } from 'graphql-yoga'

const typeDefs = /* GraphQL */ `
type Query {
Expand All @@ -17,13 +17,13 @@ const resolvers = {
},
}

const server = createServer({
schema: {
typeDefs,
resolvers,
},
endpoint: '/api/graphql',
// graphiql: false // uncomment to disable GraphiQL
const schema = createSchema({
typeDefs,
resolvers,
})

export default server
export default createYoga({
schema,
// Needed to be defined explicitly because our endpoint lives at a different path other than `/graphql`
graphqlEndpoint: '/api/graphql',
})