Skip to content

Instantly share code, notes, and snippets.

@luandevpro luandevpro/index.js
Last active May 9, 2019

Embed
What would you like to do?
const { ApolloServer , gql } = require("apollo-server-express")
const express = require("express")
const { Prisma } = require("prisma-binding")
const app = express()
const { User } = require("./typeDefs")
const { resolverQuery } = require("./resolvers")
const apollo = new ApolloServer({
typeDefs: [ User ],
resolvers: [resolverQuery],
context: async () => {
const prisma = await new Prisma({
typeDefs: "src/generated/prisma.graphql",
endpoint: "http://134.209.102.11:4466/graphql/dev",
secret: "tacayaha",
})
return {
prisma
}
}
})
apollo.applyMiddleware({app, path: "/"})
app.listen({ port: 4000 }, () =>
console.log(`🚀 Server ready at http://localhost:4000${apollo.graphqlPath}`)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.