-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix warning: Type "Node" is missing a "resolveType" resolver
- Loading branch information
1 parent
e82afe1
commit 11de3b5
Showing
1 changed file
with
17 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`); |