-
|
I'm tying to make an graphQL endpoint in a already existing express project, Have a authentication middleware that evaluates the token and attach user object to req (req.user) I want to be able to get this user in the resolver. example: if I import createHandler like this
req.user is undefined but if I import createHanlder like this:
I get req.user correctly but, the endpoints gives me timeout. What is the proper way to do this?? Thanks so much in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
The request of the underlying server is inside the router.post(
'/business2',
createHandler({
schema: schema2,
rootValue: root2,
context: (req) => ({
- user: req.user
+ user: req.raw.user
})
// Pass req.user into the context,
})
); |
Beta Was this translation helpful? Give feedback.
The request of the underlying server is inside the
rawproperty.router.post( '/business2', createHandler({ schema: schema2, rootValue: root2, context: (req) => ({ - user: req.user + user: req.raw.user }) // Pass req.user into the context, }) );