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

Compatible with Apollo Server 2.0 #16

Open
rhscjohn opened this issue May 21, 2019 · 1 comment
Open

Compatible with Apollo Server 2.0 #16

rhscjohn opened this issue May 21, 2019 · 1 comment

Comments

@rhscjohn
Copy link

rhscjohn commented May 21, 2019

In version 2.0,

You no longer need to import makeExecutableSchema from graphql-tools.
You should pass in typeDefs and resolvers as parameters to an instance of Apollo Server.

// Type definitions define the "shape" of your data and specify // which ways the data can be fetched from the GraphQL server. const typeDefs = gql
type Book {
title: String
author: String
}
type Query {
books: [Book]
}
`;

// Resolvers define the technique for fetching the types in the
// schema. We'll retrieve books from the "books" array above.
const resolvers = {
Query: {
books: () => books,
},
};

// In the most basic sense, the ApolloServer can be started
// by passing type definitions (typeDefs) and the resolvers
// responsible for fetching the data for those types.
const server = new ApolloServer({ typeDefs, resolvers });`

How does one use the joinMonsterAdapt(schema, { } in version 2. The parameter: schema no longer exists because makeExecutableSchema() is no longer used/required?

@tmartensen
Copy link

It appears that you can pass the schema in as an option to the ApolloServer constructor: https://www.apollographql.com/docs/apollo-server/api/apollo-server/#constructoroptions-apolloserver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants