Pluck the "Context" section from the middle of the "Integrations".

This looks like it's been buried in the README.md after several rounds of
adding new integrations.  This moves it back out on its own.
This commit is contained in:
Jesse Rosenberger 2019-02-26 09:48:36 +02:00
parent a7597913d2
commit ff4d6cc378
No known key found for this signature in database
GPG key ID: C0CCCF81AA6C08D8

View file

@ -223,20 +223,6 @@ async function StartServer() {
StartServer().catch(error => console.log(error));
```
### Context
The context is created for each request. The following code snippet shows the creation of a context. The arguments are the `request`, the request, and `h`, the response toolkit.
```js
new ApolloServer({
typeDefs,
resolvers,
context: async ({ request, h }) => {
return { ... };
},
})
```
## Fastify
```js
@ -282,6 +268,20 @@ const server = new ApolloServer({ typeDefs, resolvers });
exports.graphqlHandler = server.createHandler();
```
### Context
The context is created for each request. The following code snippet shows the creation of a context. The arguments are the `request`, the request, and `h`, the response toolkit.
```js
new ApolloServer({
typeDefs,
resolvers,
context: async ({ request, h }) => {
return { ... };
},
})
```
## Apollo Server Development
If you want to develop Apollo Server locally you must follow the following instructions: