prisma-labs / graphql-framework-experiment

Code-First Type-Safe GraphQL Framework
https://nexusjs.org
MIT License
673 stars 66 forks source link

How to utilise Apollo Server with Prisma 2/Nexus? #1367

Open TheoMer opened 4 years ago

TheoMer commented 4 years ago

"nexus": "^0.26.0-next.3", "nexus-plugin-prisma": "^0.16.1", "ts-node": "^8.10.2", "typescript": "^3.9.6", "ts-node-dev": "^1.0.0-pre.50" "apollo-server-express": "^2.9.14"

So I'm following verbatum (graphql.ts/nexus.graphql) the [prisma-binding to Nexus](path (https://www.prisma.io/docs/guides/upgrade-guides/upgrade-from-prisma-1/upgrading-prisma-binding-to-nexus#3-migrate-graphql-operations)) documentation to migrate from Prisma 1 to 2, but wish to utilise my existing Apollo Server.

The Old to new Nexus documentation states:

With the new Nexus Framework, you don't need to create your GraphQLSchema instance manually any more as was done with makeSchema or makePrismaSchema before.

So what specific steps, in my instance, do I need to implement on Apollo Server to get it to work?

My current Apollo Server (Prisma 1 implementation) files are as follows:

  1. index.ts - https://gist.github.com/TheoMer/f931e0528efb878333d10a079cec1421
  2. createServer.ts - https://gist.github.com/TheoMer/a53e9734a5f3cb16dbaf8f1b1c653286
  3. db.ts - https://gist.github.com/TheoMer/fb0deb45805524b057583e92cf516db5
jasonkuhrt commented 4 years ago

Apollo Server is bundled. If you were looking for engine settings follow https://github.com/graphql-nexus/nexus/pull/1388.