diff --git a/docs/source/api/apollo-server.mdx b/docs/source/api/apollo-server.mdx index d624b354d04..d6aa25abbff 100644 --- a/docs/source/api/apollo-server.mdx +++ b/docs/source/api/apollo-server.mdx @@ -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 | {
  event: [`APIGatewayProxyEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/aws-lambda/index.d.ts#L78-L92),
  context: [`LambdaContext`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/aws-lambda/index.d.ts#L510-L534),
  express: {
    req: [`express.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts),
    res: [`express.Response`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts#L490-L861)
  }
}
| -| Azure Functions | {
  request: [`HttpRequest`](https://github.com/Azure/azure-functions-nodejs-worker/blob/ba8402bd3e86344e68cb06f65f9740b5d05a9700/types/public/Interfaces.d.ts#L73-L108),
  context: [`Context`](https://github.com/Azure/azure-functions-nodejs-worker/blob/ba8402bd3e86344e68cb06f65f9740b5d05a9700/types/public/Interfaces.d.ts#L18-L69)
}
| -| Cloudflare | { req: [`Request`](https://github.com/apollographql/apollo-server/blob/04fe6aa1314ca84de26b4dc26e9b29dda16b81bc/packages/apollo-server-env/src/fetch.d.ts#L37-L45) } | -| Express (including `apollo-server`) | {
  req: [`express.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts),
  res: [`express.Response`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts#L490-L861)
}
| -| Fastify | {
  request: [`FastifyRequest`](https://github.com/fastify/fastify/blob/1d4dcf2bcde46256c72e96c2cafc843a461c721e/types/request.d.ts#L15),
  reply: [`FastifyReply`](https://github.com/fastify/fastify/blob/1d4dcf2bcde46256c72e96c2cafc843a461c721e/types/reply.d.ts#L10)
}
| -| Google Cloud Functions | { 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) } | -| hapi | {
  request: [`hapi.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/05cbc5521f895344fb7dbf5c51902b6ff235aa69/types/hapi__hapi/index.d.ts#L406-L615),
  h: [`hapi.ResponseToolkit`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/05cbc5521f895344fb7dbf5c51902b6ff235aa69/types/hapi__hapi/index.d.ts#L999-L1113)
}
| -| Koa | { ctx: [`Koa.Context`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/koa/index.d.ts#L724-L731) } | -| Micro | { 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) } | +| 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)
- [`LambdaContext`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/aws-lambda/index.d.ts#L510-L534)
- [`express.Request`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/express-serve-static-core/index.d.ts)
- [`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)
- [`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)
- [`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)
- [`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)
- [`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)
- [`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)
- [`ServerResponse`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/50adc95acf873e714256074311353232fcc1b5ed/types/node/v10/http.d.ts#L145-L158) | + ## `listen` diff --git a/docs/source/api/plugin/usage-reporting.md b/docs/source/api/plugin/usage-reporting.md index d817d5a4897..39ea90e19ee 100644 --- a/docs/source/api/plugin/usage-reporting.md +++ b/docs/source/api/plugin/usage-reporting.md @@ -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. diff --git a/docs/source/data/subscriptions.mdx b/docs/source/data/subscriptions.mdx index 14683d49405..eb5215c8515 100644 --- a/docs/source/data/subscriptions.mdx +++ b/docs/source/data/subscriptions.mdx @@ -211,7 +211,7 @@ httpServer.listen(PORT, () => { -> ⚠️ **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 @@ -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. @@ -609,19 +609,19 @@ If you intend to [switch from `subscriptions-transport-ws` to `graphql-ws`](#swi -[Apollo Studio Explorer](/studio/explorer/explorer/) +[Apollo Studio Explorer](/graphos/platform/explorer) -[`graphql-ws`](/studio/explorer/additional-features/#subscription-support) +[`graphql-ws`](/graphos/platform/explorer/subscription-support) -[`subscriptions-transport-ws`](/studio/explorer/additional-features/#subscription-support) +[`subscriptions-transport-ws`](/graphos/platform/explorer/subscription-support) @@ -652,7 +652,7 @@ Use [`WebSocketLink`](/react/api/link/apollo-link-ws/) -[Apollo iOS](/ios/subscriptions/) +[Apollo iOS](/ios/fetching/subscriptions/) diff --git a/docs/source/index.mdx b/docs/source/index.mdx index a50f7112fbb..6a56976af55 100644 --- a/docs/source/index.mdx +++ b/docs/source/index.mdx @@ -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: diff --git a/docs/source/security/cors.mdx b/docs/source/security/cors.mdx index 8e4a0a1a1fa..46c0a2088e0 100644 --- a/docs/source/security/cors.mdx +++ b/docs/source/security/cors.mdx @@ -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 @@ -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 @@ -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