-
Hello Guys, Congrats on v3. I really liked it. it's nice and clean🎉 earlier I used |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @ethdev279! Loading conditional schemas based on the request is documented here: https://the-guild.dev/graphql/yoga-server/docs/features/schema#conditional-schema import { createServer } from 'node:http'
import { createYoga } from 'graphql-yoga'
import { getSchemaForViewer } from './schema.js'
const yoga = createYoga({
schema: async (request) =>
getSchemaForViewer(request.headers.get('x-schema') ?? 'default')
})
const server = createServer(yoga)
// Start the server and you're done!
server.listen(4000, () => {
console.info('Server is running on http://localhost:4000/graphql')
}) |
Beta Was this translation helpful? Give feedback.
Hey @ethdev279!
Loading conditional schemas based on the request is documented here: https://the-guild.dev/graphql/yoga-server/docs/features/schema#conditional-schema