Skip to content

Add support for adding response to the context on custom Express server #506

Closed
@robin-macpherson

Description

@robin-macpherson

What

  • Currently, we cannot set up the express server so that we can access the response from inside of resolvers.

Why

  • It's important to support this so that users can do things like -- in my current use case -- access the cookie on the response inside of resolvers, which could be important for a lot of basic authentication setups, for example with Jason Web Tokens as I am doing.

How

  • We should add support so that we can pass the response as a second parameter in schema.addToContext along with the request, with an implementation that would look something like:
schema.addToContext((request, response) => ({
  request,
  response,
}))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions