Created
May 17, 2020 21:16
-
-
Save marshallmurphy/6e66d6abe8e96afc54bd001dbe455e74 to your computer and use it in GitHub Desktop.
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
// src/index.js | |
const { GraphQLServer } = require('graphql-yoga') | |
const { prisma } = require('../prisma/generated/prisma-client') | |
// import Query file | |
const Query = require('./resolvers/Query') | |
// add Query as a resolver | |
const resolvers = { | |
Query | |
} | |
// add resolvers to graphql server | |
const server = new GraphQLServer({ | |
typeDefs: './src/schema.graphql', | |
resolvers, | |
context: request => { | |
return { | |
...request, | |
prisma, | |
} | |
}, | |
}) | |
server.start(() => console.log(`Server is running on http://localhost:4000`)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment