Skip to content

Commit 069110b

Browse files
rkorrelboomabernix
authored andcommitted
feat(Fastify) Apollo server Fastify integration #626 (#1971)
* feat(fastify) Apollo Fastify server integration resolve #626 * feat(fastify) Use createHandler instead of applyMiddleware #626 * feat(fastify) Fix integration test for node 10 #626 * feat(fastify) Update README's with fastify createHandler interface #626 * feat(fastify) Implement the fastify createHandler as a synchronous method #626 * (fastify) Tweaks to re-align with the parallel work in #2054. * (fastify): Use port 9999 rather than 8888 for tests. Because Gatsby. This specific port per integration is pretty brittle to begin with, but it does work. Currently, the fact that it works is facilitated by the fact that most people don't use 5555 (Hapi) and 6666 (Express) for anything. That said, the ever-popular Gatsby uses 8888 by default, so let's use 9999! * (fastify) Remove duplicative assertion in upload initialization. * (fastify) Implement fastify upload middleware * (fastify) Fix linting issues * (fastify) Update package-lock
1 parent 7d54688 commit 069110b

18 files changed

+1847
-22
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ client reference ID, Apollo Server will now default to the values present in the
4444
of the request (`apollographql-client-name`, `apollographql-client-reference-id` and
4545
`apollographql-client-version` respectively). As a last resort, when those headers are not set,
4646
the query extensions' `clientInfo` values will be used. [PR #1960](https://github.com/apollographql/apollo-server/pull/1960)
47+
- Added `apollo-server-fastify` integration ([@rkorrelboom](https://github.com/rkorrelboom) in [#1971](https://github.com/apollostack/apollo-server/pull/1971))
4748

4849
### v2.2.2
4950

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Often times, Apollo Server needs to be run with a particular integration. To sta
8686
- `apollo-server-express`
8787
- `apollo-server-koa`
8888
- `apollo-server-hapi`
89+
- `apollo-server-fastify`
8990
- `apollo-server-lambda`
9091
- `apollo-server-azure-functions`
9192
- `apollo-server-cloud-functions`
@@ -235,6 +236,25 @@ new ApolloServer({
235236
})
236237
```
237238

239+
## Fastify
240+
241+
```js
242+
const { ApolloServer, gql } = require('apollo-server-fastify');
243+
const { typeDefs, resolvers } = require('./module');
244+
245+
const server = new ApolloServer({
246+
typeDefs,
247+
resolvers,
248+
});
249+
250+
const app = require('fastify')();
251+
252+
(async function () {
253+
app.register(server.createHandler());
254+
await app.listen(3000);
255+
})();
256+
```
257+
238258
### AWS Lambda
239259

240260
Apollo Server can be run on Lambda and deployed with AWS Serverless Application Model (SAM). It requires an API Gateway with Lambda Proxy Integration.

0 commit comments

Comments
 (0)