Repository navigation
feat(apollo): support the node http adapter - #4202
Merged
Merged
Conversation
The Apollo driver threw "No support for current HttpAdapter: node" for the native Node adapter of @nestjs/platform-node (12.3.0). Its requests and responses carry the Express API that Apollo's Express integration (@as-integrations/express5) uses, so the driver now registers the server the same way as for Express. Queries, the GraphiQL landing page, a global prefix and graphql-ws subscriptions are covered by e2e specs on the Node adapter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The Apollo driver throws
No support for current HttpAdapter: nodewith the native Node adapter of@nestjs/platform-node(12.3.0).Issue Number: N/A
What is the new behavior?
The driver registers Apollo for the Node adapter as it does for Express, through
@as-integrations/express5. The adapter's requests and responses carry the Express API that integration uses (req.body,req.headers,req.url,res.status(),res.send(),res.setHeader(),res.write()), and it imports nothing fromexpressat runtime.New e2e specs run on the Node adapter:
e2e/graphql-node.spec.ts: a query and the GraphiQL landing pagee2e/global-prefix-node.spec.ts: the cases ofglobal-prefix.spec.tssubscriptions/graphql-ws-node.spec.ts: the graphql-ws casesThey fail without the change. The whole Apollo e2e suite passes (62 files, 243 tests).
@nestjs/platform-node12.3.0 is added as a devDependency for these specs. Mercurius stays Fastify-only.This works with
@nestjs/platform-node12.3.0 as published, so there's nothing to wait for before releasing.Does this PR introduce a breaking change?
Other information