I am trying to create a Schema, however is going to get too long and confusing, what are the best practices to split the different queries, mutations and inputs so I can just r
There are multiple options, here are three of them:
You can take a look at Apollo's blog - they show a way to modularize the schema: Modularizing your GraphQL schema code If you want an example, you can take a look at this github repository
Of course you can always just use the template literals to embed parts of the schema as strings:
const countryType = `
type Country {
_id: ID!
name: String!
region: [Region!]!
}
`
const regionType = `
type Region {
_id: ID!
name: String!
countries: [Country!]
}
`
const schema = `
${countryType}
${regionType}
# ... more stuff ...
`
module.exports = buildSchema(schema);