I'm using express-graphql in my nodejs app.
In order to get access to the database from the resolvers, I have created an object called ProjectHandler
(which handles a table in the database called projects
) and I'm injecting it to the resolvers by changing the context
when creating the express-graphql
instance, like so:
app.use('/graphql', graphqlHTTP({
schema,
graphiql: true,
context: {projectsHandler}
}))
problem is, this replaces the default context from being a representation of the request object, preventing me from accessing session information.
The thing is, that I need both the session information and the project handler. How do I do that?