Skip to content

Instantly share code, notes, and snippets.

@JeffML
Last active August 21, 2017 00:29
Show Gist options
  • Save JeffML/ad5610cba9b47e6bfad5d598eebb082c to your computer and use it in GitHub Desktop.
Save JeffML/ad5610cba9b47e6bfad5d598eebb082c to your computer and use it in GitHub Desktop.
Reorg: root schema
import {
makeExecutableSchema
} from 'graphql-tools';
import {
schema as authorpostsSchema,
resolvers as authorpostsResolvers
} from './authorposts';
const baseSchema = [
`
type Query {
domain: String
}
type Mutation {
domain: String
}
schema {
query: Query,
mutation: Mutation
}`
]
// Put schema together into one array of schema strings and one map of resolvers, like makeExecutableSchema expects
const schema = [...baseSchema, ...authorpostsSchema]
const options = {
typeDefs: schema,
resolvers: {...authorPostResolvers}
}
const executableSchema = makeExecutableSchema(options);
export default executableSchema;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment