Skip to content

Instantly share code, notes, and snippets.

@redbluenat
Last active November 26, 2018 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redbluenat/312326822a8b3fcd087cedc04de2f82a to your computer and use it in GitHub Desktop.
Save redbluenat/312326822a8b3fcd087cedc04de2f82a to your computer and use it in GitHub Desktop.
const { GraphQLServer } = require('graphql-yoga');
const { Prisma } = require('prisma-binding');
const typeDefs = `
type Query {
dogName: String!
}
`;
const resolvers = {
Query: {
dogName: () => `Tommy the chihuahua`
}
};
const server = new GraphQLServer({
typeDefs,
resolvers,
context: req => ({
...req,
db: new Prisma({
typeDefs: 'src/generated/prisma.graphql',
endpoint: 'YOUR_ENDPOINT_PATH',
secret: 'testsecret',
debug: true
})
})
});
server.start(() => console.log(`Server address: http://localhost:4000`));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment