Skip to content

Instantly share code, notes, and snippets.

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 bloo/afe080914150fa6297ab1ae79b340595 to your computer and use it in GitHub Desktop.
Save bloo/afe080914150fa6297ab1ae79b340595 to your computer and use it in GitHub Desktop.
Resilient Tech Blog - Code-first GraphQL with Nexus - app.ts
import { ApolloServer } from 'apollo-server'
import { PrismaClient } from '@prisma/client'
import { schema } from './schema'
const prismaClient = new PrismaClient()
const server = new ApolloServer({
schema,
// context is a function that is invoked on every GraphQL request.
context: () => ({
db: prismaClient
})
});
// The `listen` method launches a web server.
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment