Created
April 7, 2021 15:05
-
-
Save bloo/afe080914150fa6297ab1ae79b340595 to your computer and use it in GitHub Desktop.
Resilient Tech Blog - Code-first GraphQL with Nexus - app.ts
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
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