How can i pass express Request and Response objects into graphql-yoga context using the createYoga function?
I want to pass the express req
and res
object to my context because i want to use express-sessions
to do session-based-auth because the default requests
from the context does not know about sessions. Here is what I have tried
app.use("/graphql", (req, res) => {
return createYoga({
context: ({ params }) => {
return {
req,
params,
res,
prisma,
redis: redisClient,
};
},
开发者_JAVA技巧 graphiql: true,
landingPage: false,
cors: false,
schema,
});
});
But if i try this it seems like the request is not going through.
精彩评论