Multiple schemas/endpoints #3160
lutzissler
started this conversation in
General
Replies: 1 comment
-
Hi, I have never tried this kind of setup but I don't see any reason for it to not be supported. You will just need to use an HTTP router for your server, or ure an HTPP server framework that have one already packed like import express from 'express'
import { createYoga } from 'graphql-yoga'
const app = express()
const yoga = createYoga({
graphqlEndpoint: '/graphql1'
})
// Bind GraphQL Yoga to the graphql endpoint to avoid rendering the playground on any path
app.use(yoga.graphqlEndpoint, yoga)
const yoga2 = createYoga({
graphqlEndpoint: '/graphql2'
})
// Bind GraphQL Yoga to the graphql endpoint to avoid rendering the playground on any path
app.use(yoga2.graphqlEndpoint, yoga2)
app.listen(4000, () => {
console.log('Running a GraphQL API server at http://localhost:4000/graphql')
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We want to expose multiple schemas/graphs through multiple endpoints. That has been discussed/asked very early in issues #41 and #247 already but back then wasn’t identified as relevant use case.
Has this feature been built in ever since, or can someone provide some best practice insights on how to achieve that?
Beta Was this translation helpful? Give feedback.
All reactions