MichalLytek / typegraphql-prisma

Prisma generator to emit TypeGraphQL types and CRUD resolvers from your Prisma schema
https://prisma.typegraphql.com
MIT License
891 stars 113 forks source link

Update usage.md to include the apollo-serve v4 #350

Closed alvaaz closed 1 year ago

alvaaz commented 1 year ago

With apollo-server v4, the way to pass context changed.

const server = new ApolloServer<MyContext>({ typeDefs, resolvers });
const { url } = await startStandaloneServer(server, {
  context: async ({ req }) => ({ token: req.headers.token }),
  listen: { port: 4000 },
});
console.log(`🚀  Server ready at ${url}`);
MichalLytek commented 1 year ago

I would prefer to update docs and examples to use new apollo server 🤔

alvaaz commented 1 year ago

What about the “caution”? Because in the docs, you don't say which apollo version is using (apollo-server, apollo-server-micro, or @apollo-server). I would include the Apollo v4 example, including the caution.

We could add an Info area to say something like:

Be aware that we are using @apollo-server v4 for all examples. The new version changes the way where pass Prisma context. Read more in Migrate from apollo-server guide

MichalLytek commented 1 year ago

Closing as superseded by 39bba26 :lock:

The docs are now describing apollo v4 and graphql yoga as an alternative. Examples are still on apollo v3.