howtographql / graphql-js

https://www.howtographql.com/graphql-js/1-getting-started/
363 stars 123 forks source link

Some tuto steps missing ? #80

Open Totone opened 3 years ago

Totone commented 3 years ago

Hi, & first thanks for this tuto, really helpful to learn GraphQL I'm facing an understanding issue.

I finished chapter "Connecting The Server and Database with Prisma Client" & started the following "Realtime GraphQL Subscriptions"

In this new chapter, context is defined like this:

const server = new ApolloServer({
  typeDefs: fs.readFileSync(
    path.join(__dirname, 'schema.graphql'),
    'utf8'
  ),
  resolvers,
  context: ({ req }) => {
    return {
      ...req,
      prisma,
      pubsub
      userId:
        req && req.headers.authorization
          ? getUserId(req)
          : null
    };
  }
});

But in the previous chapter, context was just an object which stored prisma instance. A funny thing is that it's written Now, in the same file, add pubsub to the context, just as did with prisma: but I didn't do like this at all with prisma.

As well, the tuto invites us to create a new file in resolver/ folder. If I can understand why a modular structure, I'm sure that this folder hasn't been created yet.

Is there a step missing ?

swap1789 commented 3 years ago

Right, even i cannot find tutorials about authentication - User model, resolver etc. Please update.

Thanks

remuspoienar commented 3 years ago

i came across part 6 in google when searching some auth tutorials on graphql. This is the link