Skip to content

Commit

Permalink
Fix warning: Type "Node" is missing a "resolveType" resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
dbritto-dev committed Dec 9, 2018
1 parent e82afe1 commit 11de3b5
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
const { ApolloServer, gql } = require("apollo-server")
const { Prisma } = require("prisma-binding")
const { importSchema } = require("graphql-import")
const resolvers = require("./resolvers")
const { ApolloServer, makeExecutableSchema } = require('apollo-server');
const { Prisma } = require('prisma-binding');
const { importSchema } = require('graphql-import');

const server = new ApolloServer({
typeDefs: importSchema("./src/schema.graphql"),
const typeDefs = importSchema('./src/schema.graphql');
const resolvers = require('./resolvers');
const schema = makeExecutableSchema({
typeDefs,
resolvers,
resolverValidationOptions: {
requireResolversForResolveType: false,
},
});

const server = new ApolloServer({
schema,
context: req => ({
...req,
db: new Prisma({
typeDefs: "./src/generated/prisma.graphql", // the auto-generated GraphQL schema of the Prisma API
typeDefs: './src/generated/prisma.graphql', // the auto-generated GraphQL schema of the Prisma API
endpoint: process.env.PRISMA_ENDPOINT, // the endpoint of the Prisma API
debug: true, // log all GraphQL queries & mutations sent to the Prisma API
// secret: process.env.PRISMA_SECRET, // only needed if specified in `database/prisma.yml`
}),
}),
})
});

server.listen().then(({ url }) => `🚀 Server ready at ${url}`)
server.listen().then(({ url }) => `🚀 Server ready at ${url}`);

0 comments on commit 11de3b5

Please sign in to comment.