You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: provide TS versions of examples with await new Promise (#5825)
TypeScript does not infer `Promise<void>` for `await new Promise(...)`
(see microsoft/TypeScript#40162) which means
that this idiom requires us to write `await new Promise<void>(...)`. But
that's not valid JS.
Fortunately @trevorblades has gifted us with a magical MultiCodeBlock
component which lets us write TypeScript and make it available to users
as both TS and JS! It runs Babel and Prettier on it but doesn't do any
type checking.
I've found all the examples that use `await new Promise` in the docs
(and the other examples on the "which package" page for consistency) and
changed them to use MultiCodeBlock.
I made some minor formatting changes to minimize the diff between the TS
and JS versions. Note that I am leaving them in apollo-server's
preferred Prettier style (single quotes, trailing commas) even though
the component runs Prettier with default options; @trevorblades says we
can get the ability to override Prettier options soon, so that can be a
follow-up PR.
Fixes#5822.
This API reference documents the `ApolloServer` class.
8
10
9
11
There are [multiple implementations](../integrations/middleware/) of `ApolloServer` for different web frameworks with slightly different behavior.
@@ -269,6 +271,7 @@ Provide this function to transform the structure of GraphQL response objects bef
269
271
##### `apollo`
270
272
271
273
`Object`
274
+
</td>
272
275
<td>
273
276
274
277
An object containing configuration options for connecting Apollo Server to [Apollo Studio](https://www.apollographql.com/docs/studio/). Each field of this object can also be set with an environment variable, which is the recommended method of setting these parameters. All fields are optional. The fields are:
@@ -500,7 +503,7 @@ The `context` object passed between Apollo Server resolvers automatically includ
@@ -610,9 +613,11 @@ You call this method instead of [`listen`](#listen) if you're using a framework-
610
613
611
614
These functions take an `options` object as a parameter. Some supported fields of this object are described below. **Not all packages support all options.** See [your package's description](../integrations/middleware/#basic-usage) to see what the name of the function is and which options are supported.
612
615
613
-
### Example
616
+
Here's an example of using `applyMiddleware` with `apollo-server-express`.
This API reference documents the `ApolloServerPluginDrainHttpServer` plugin.
@@ -24,7 +26,9 @@ This plugin is exported from the `apollo-server-core` package. It is tested with
24
26
25
27
Here's a basic example of how to use it with Express. See the [framework integrations docs](../../integrations/middleware/) for examples of how to use it with other frameworks.
You can add file upload support to Apollo Server via the third-party [`graphql-upload`](https://npm.im/graphql-upload) library. This package provides support for the `multipart/form-data` content-type.
7
9
8
10
**New in Apollo Server 3:** Apollo Server 3 does not contain a built-in integration with `graphql-upload` like in Apollo Server 2. Instead, the instructions below show how to integrate it yourself. You cannot do this with the "batteries-included" `apollo-server` library; you must use a web framework integration such as `apollo-server-express` instead. This page shows out to integrate `graphql-upload` with Express and Fastify. To implement similar functionality with another Node.js HTTP framework (e.g., Koa), see the [`graphql-upload` documentation](https://github.com/jaydenseric/graphql-upload) for more information. Some integrations might need to use `graphql-upload`'s `processRequest` directly.
0 commit comments