Skip to content

Commit

Permalink
Merge pull request #7939 from apollographql/version-3-docs-replatform
Browse files Browse the repository at this point in the history
docs: v3 docs update
  • Loading branch information
Meschreiber authored Oct 16, 2024
2 parents 09d3137 + 616ed98 commit 99987aa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
23 changes: 12 additions & 11 deletions docs/source/api/apollo-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -565,17 +565,18 @@ The default value is `10_000` (10 seconds).

The `context` object passed between Apollo Server resolvers automatically includes certain fields, depending on which [Node.js middleware](../integrations/middleware/) you're using:

| Middleware | Context fields |
|---|---|
| AWS Lambda | <code>{<br/>&nbsp;&nbsp;event: [`APIGatewayProxyEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/aws-lambda/index.d.ts#L78-L92),<br/>&nbsp;&nbsp;context: [`LambdaContext`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/aws-lambda/index.d.ts#L510-L534),<br/>&nbsp;&nbsp;express: {<br/>&nbsp;&nbsp;&nbsp;&nbsp;req: [`express.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts),<br/>&nbsp;&nbsp;&nbsp;&nbsp;res: [`express.Response`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts#L490-L861)<br/>&nbsp;&nbsp;}<br/>}</code> |
| Azure Functions | <code>{<br/>&nbsp;&nbsp;request: [`HttpRequest`](https://github.com/Azure/azure-functions-nodejs-worker/blob/ba8402bd3e86344e68cb06f65f9740b5d05a9700/types/public/Interfaces.d.ts#L73-L108),<br/>&nbsp;&nbsp;context: [`Context`](https://github.com/Azure/azure-functions-nodejs-worker/blob/ba8402bd3e86344e68cb06f65f9740b5d05a9700/types/public/Interfaces.d.ts#L18-L69)<br/>}</code> |
| Cloudflare | <code>{ req: [`Request`](https://github.com/apollographql/apollo-server/blob/04fe6aa1314ca84de26b4dc26e9b29dda16b81bc/packages/apollo-server-env/src/fetch.d.ts#L37-L45) }</code> |
| Express (including `apollo-server`) | <code>{<br/>&nbsp;&nbsp;req: [`express.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts),<br/>&nbsp;&nbsp;res: [`express.Response`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts#L490-L861)<br/>}</code> |
| Fastify | <code>{<br/>&nbsp;&nbsp;request: [`FastifyRequest`](https://github.com/fastify/fastify/blob/1d4dcf2bcde46256c72e96c2cafc843a461c721e/types/request.d.ts#L15),<br/>&nbsp;&nbsp;reply: [`FastifyReply`](https://github.com/fastify/fastify/blob/1d4dcf2bcde46256c72e96c2cafc843a461c721e/types/reply.d.ts#L10)<br/>}</code> |
| Google Cloud Functions | <code>{ req: [`Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts), res: [`Response`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts#L490-L861) }</code> |
| hapi | <code>{<br/>&nbsp;&nbsp;request: [`hapi.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/05cbc5521f895344fb7dbf5c51902b6ff235aa69/types/hapi__hapi/index.d.ts#L406-L615),<br/>&nbsp;&nbsp;h: [`hapi.ResponseToolkit`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/05cbc5521f895344fb7dbf5c51902b6ff235aa69/types/hapi__hapi/index.d.ts#L999-L1113)<br/>}</code> |
| Koa | <code>{ ctx: [`Koa.Context`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/koa/index.d.ts#L724-L731) }</code> |
| Micro | <code>{ req: [`MicroRequest`](https://github.com/apollographql/apollo-server/blob/c356bcf3f2864b8d2fcca0add455071e0606ef46/packages/apollo-server-micro/src/types.ts#L3-L5), res: [`ServerResponse`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/node/v10/http.d.ts#L145-L158) }</code> |
| Middleware | Context Fields | Reference Links |
|-------------------------|---------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| AWS Lambda | ```js { event: APIGatewayProxyEvent, context: LambdaContext, express: { req: express.Request, res: express.Response } }``` | - [`APIGatewayProxyEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/aws-lambda/index.d.ts#L78-L92) <br/> - [`LambdaContext`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/aws-lambda/index.d.ts#L510-L534) <br/> - [`express.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts) <br/> - [`express.Response`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts#L490-L861) |
| Azure Functions | ```js { request: HttpRequest, context: Context }``` | - [`HttpRequest`](https://github.com/Azure/azure-functions-nodejs-worker/blob/ba8402bd3e86344e68cb06f65f9740b5d05a9700/types/public/Interfaces.d.ts#L73-L108) <br/> - [`Context`](https://github.com/Azure/azure-functions-nodejs-worker/blob/ba8402bd3e86344e68cb06f65f9740b5d05a9700/types/public/Interfaces.d.ts#L18-L69) |
| Cloudflare | ```js { req: Request }``` | - [`Request`](https://github.com/apollographql/apollo-server/blob/04fe6aa1314ca84de26b4dc26e9b29dda16b81bc/packages/apollo-server-env/src/fetch.d.ts#L37-L45) |
| Express (including `apollo-server`) | ```js { req: express.Request, res: express.Response }``` | - [`express.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts) <br/> - [`express.Response`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts#L490-L861) |
| Fastify | ```js { request: FastifyRequest, reply: FastifyReply }``` | - [`FastifyRequest`](https://github.com/fastify/fastify/blob/1d4dcf2bcde46256c72e96c2cafc843a461c721e/types/request.d.ts#L15) <br/> - [`FastifyReply`](https://github.com/fastify/fastify/blob/1d4dcf2bcde46256c72e96c2cafc843a461c721e/types/reply.d.ts#L10) |
| Google Cloud Functions | ```js { req: Request, res: Response }``` | - [`Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts) <br/> - [`Response`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts#L490-L861) |
| hapi | ```js { request: hapi.Request, h: hapi.ResponseToolkit }``` | - [`hapi.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/05cbc5521f895344fb7dbf5c51902b6ff235aa69/types/hapi__hapi/index.d.ts#L406-L615) <br/> - [`hapi.ResponseToolkit`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/05cbc5521f895344fb7dbf5c51902b6ff235aa69/types/hapi__hapi/index.d.ts#L999-L1113) |
| Koa | ```js { ctx: Koa.Context }``` | - [`Koa.Context`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/koa/index.d.ts#L724-L731) |
| Micro | ```js { req: MicroRequest, res: ServerResponse }``` | - [`MicroRequest`](https://github.com/apollographql/apollo-server/blob/c356bcf3f2864b8d2fcca0add455071e0606ef46/packages/apollo-server-micro/src/types.ts#L3-L5) <br/> - [`ServerResponse`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/node/v10/http.d.ts#L145-L158) |


## `listen`

Expand Down
2 changes: 1 addition & 1 deletion docs/source/api/plugin/usage-reporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Providing a number `x` is equivalent to passing this function:
* The operation _doesn't_ produce a trace that can be viewed in the Traces section of the Operations page in Studio.
* The operation _does_ still contribute to most features of Studio, such as schema checks, the Operations page, and the "referencing operations" statistic on the Fields page.

(For more information about the difference between the "referencing operations" and "field executions" statistics, see [the Studio Fields page documentation](https://apollographql.com/docs/studio/metrics/field-usage/).)
(For more information about the difference between the "referencing operations" and "field executions" statistics, see the [field usage documentation](/graphos/platform/insights/field-usage).)

Returning `false` (or `0`) for some or all operations can improve your server's performance, because calculating complete traces can introduce significant overhead. This is especially true for a federated graph, because traces are transmitted from the subgraph to the Gateway in-band inside the actual GraphQL response.

Expand Down
12 changes: 6 additions & 6 deletions docs/source/data/subscriptions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ httpServer.listen(PORT, () => {
</ExpansionPanel>
> ⚠️ **Running into an error?** If you're using the `graphql-ws` library, your specified subscription protocol must be consistent across your backend, frontend, and **every other tool** you use (including [Apollo Sandbox](/studio/explorer/additional-features/#subscription-support)). For more information, see [Switching from `subscriptions-transport-ws`](#switching-from-subscriptions-transport-ws).
> ⚠️ **Running into an error?** If you're using the `graphql-ws` library, your specified subscription protocol must be consistent across your backend, frontend, and **every other tool** you use (including [Apollo Sandbox](/graphos/platform/explorer/subscription-support). For more information, see [Switching from `subscriptions-transport-ws`](#switching-from-subscriptions-transport-ws).
## Resolving a subscription
Expand Down Expand Up @@ -412,7 +412,7 @@ subscription IncrementingNumber {
}
```
> If you don't see the result of your subscription operation you might need to [adjust your Sandbox settings to use the `graphql-ws` protocol](/studio/explorer/additional-features/#subscription-support).
> If you don't see the result of your subscription operation you might need to [adjust your Sandbox settings to use the `graphql-ws` protocol](/graphos/platform/explorer/subscription-support).
After you start up the server in CodeSandbox, follow the instructions in the browser to test running the `numberIncremented` subscription in Apollo Sandbox. You should see the subscription's value update every second.
Expand Down Expand Up @@ -609,19 +609,19 @@ If you intend to [switch from `subscriptions-transport-ws` to `graphql-ws`](#swi
<tr>
<td>
[Apollo Studio Explorer](/studio/explorer/explorer/)
[Apollo Studio Explorer](/graphos/platform/explorer)
</td>
<td>
[`graphql-ws`](/studio/explorer/additional-features/#subscription-support)
[`graphql-ws`](/graphos/platform/explorer/subscription-support)
</td>
<td>
[`subscriptions-transport-ws`](/studio/explorer/additional-features/#subscription-support)
[`subscriptions-transport-ws`](/graphos/platform/explorer/subscription-support)
</td>
</tr>
Expand Down Expand Up @@ -652,7 +652,7 @@ Use [`WebSocketLink`](/react/api/link/apollo-link-ws/)
<tr>
<td>
[Apollo iOS](/ios/subscriptions/)
[Apollo iOS](/ios/fetching/subscriptions/)
</td>
Expand Down
6 changes: 3 additions & 3 deletions docs/source/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ title: Introduction to Apollo Server

#### You can use Apollo Server as:

* A gateway for a [federated supergraph](/federation/)
* The GraphQL server for a [subgraph](/federation/subgraphs) in a federated supergraph
* A gateway for a [federated supergraph](/graphos/schema-design/federated-schemas/federation)
* The GraphQL server for a [subgraph in a federated supergraph](/graphos/get-started/concepts/graphs#supergraphs)
* A stand-alone GraphQL server, including in a serverless environment
* An add-on to your application's existing [Node.js middleware](./integrations/middleware/) (such as Express or Fastify)
* An add-on to your application's existing [Node.js middleware](/apollo-server/v3/integrations/middleware/) (such as Express or Fastify)

#### Apollo Server provides:

Expand Down
6 changes: 3 additions & 3 deletions docs/source/security/cors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ If you don't, while your personal computer is on your private network, a script

If you're building a [federated graph](/federation/), we strongly recommend that _all_ of your production subgraph servers [_disable_ CORS](../api/apollo-server#cors) (or at least specify origins and limit them to tools like the Apollo Explorer). Most subgraphs should allow communication _only_ from your gateways, and that communication doesn't involve a browser at all.

For more information, see [Securing your subgraphs](/federation/subgraphs/#securing-your-subgraphs).
For more information, see [Securing your subgraphs](/graphos/routing/cloud/secure-subgraphs).

#### APIs that require cookies

Expand Down Expand Up @@ -115,7 +115,7 @@ Under the hood, the batteries-included `apollo-server` wraps around middleware p
If you're using another integration of Apollo Server, you can add the `cors` configuration option to your framework-specific middleware function to change your server's CORS behavior. To learn more about the CORS defaults and options for your integration of Apollo Server, see [CORS configuration options](../api/apollo-server/#cors-1).

Below is an example of setting up CORS with the [`apollo-server-express`](../integrations/middleware#swapping-out-apollo-server) package:
Below is an example of setting up CORS with the [`apollo-server-express`](/apollo-server/v3/integrations/middleware#swapping-out-apollo-server) package:

```js
// ... set up the server
Expand All @@ -132,7 +132,7 @@ server.applyMiddleware({
});
```

You can also [remove CORS middleware entirely](../api/apollo-server#cors) to disable cross-origin requests. In the batteries-included `apollo-server` and `apollo-server-express`, you do this by passing `cors: false`. This is [recommended for subgraphs in a federated graph](/federation/subgraphs/#securing-your-subgraphs).
You can also [remove CORS middleware entirely](../api/apollo-server#cors) to disable cross-origin requests. In the batteries-included `apollo-server` and `apollo-server-express`, you do this by passing `cors: false`. This is [recommended for subgraphs in a federated graph](/graphos/routing/cloud/secure-subgraphs).

### Passing credentials with CORS

Expand Down

0 comments on commit 99987aa

Please sign in to comment.