Skip to content

Commit

Permalink
feat(fastify) Update README's with fastify createHandler interface ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
rkorrelboom committed Nov 22, 2018
1 parent 6d3dc26 commit fb8bd2a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 26 deletions.
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Often times, Apollo Server needs to be run with a particular integration. To sta
- `express`
- `koa`
- `hapi`
- `fastify`
- `lambda`
- `azure-function`
- `cloud-function`
Expand Down Expand Up @@ -242,23 +243,19 @@ new ApolloServer({

```js
const { ApolloServer, gql } = require('apollo-server-fastify');
const fastify = require('fastify');
const { typeDefs, resolvers } = require('./module');

async function StartServer() {
const server = new ApolloServer({ typeDefs, resolvers });

const app = fastify();

await server.applyMiddleware({
app,
});
const server = new ApolloServer({
typeDefs,
resolvers,
});

await server.installSubscriptionHandlers(app.server);
const app = require('fastify')();

(async function () {
app.register(await server.createHandler());
await app.listen(3000);
}

StartServer().catch(error => console.log(error));
})();
```

### AWS Lambda
Expand Down
22 changes: 9 additions & 13 deletions packages/apollo-server-fastify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,19 @@ npm install apollo-server-fastify

```js
const { ApolloServer, gql } = require('apollo-server-fastify');
const fastify = require('fastify');
const { typeDefs, resolvers } = require('./module');

async function StartServer() {
const server = new ApolloServer({ typeDefs, resolvers });
const server = new ApolloServer({
typeDefs,
resolvers,
});

const app = fastify();

await server.createHandler({
app,
});

await server.installSubscriptionHandlers(app.server);
const app = require('fastify')();

(async function () {
app.register(await server.createHandler());
await app.listen(3000);
}

StartServer().catch(error => console.log(error));
})();
```

## Principles
Expand Down

0 comments on commit fb8bd2a

Please sign in to comment.