mirror of
https://github.com/vale981/apollo-server
synced 2025-03-05 09:41:40 -05:00
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:
parent
a7597913d2
commit
ff4d6cc378
1 changed files with 14 additions and 14 deletions
28
README.md
28
README.md
|
@ -223,20 +223,6 @@ async function StartServer() {
|
||||||
StartServer().catch(error => console.log(error));
|
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
|
## Fastify
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -282,6 +268,20 @@ const server = new ApolloServer({ typeDefs, resolvers });
|
||||||
exports.graphqlHandler = server.createHandler();
|
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
|
## Apollo Server Development
|
||||||
|
|
||||||
If you want to develop Apollo Server locally you must follow the following instructions:
|
If you want to develop Apollo Server locally you must follow the following instructions:
|
||||||
|
|
Loading…
Add table
Reference in a new issue