Skip to content

Commit

Permalink
Added altair-koa-middleware to integration docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Apr 6, 2019
1 parent 1d9781e commit 17ff38d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
5 changes: 2 additions & 3 deletions docs/docs/index.md
Expand Up @@ -45,8 +45,7 @@ Note
It is **NOT** recommended to use the web app for full development, because there are some limitations there which might lead to frustrations if something isn't working as expected. It is preferred for you to use the desktop apps where possible, or the browser extensions for ease of use.


### Usage with express
You can use altair with an express server using [altair-express-middleware](/docs/integrations/altair-express-middleware).

### Usage with your application
You can easily integrate altair with several application setups. Check the [available integrations](/docs/integrations).

Checkout the features available in Altair [here](/docs/features).
56 changes: 56 additions & 0 deletions docs/docs/integrations/altair-koa-middleware.md
@@ -0,0 +1,56 @@
---
parent: Integrations
---

## altair-koa-middleware
npm
{: .label .label-red }
Koa
{: .label .label-purple }

You can use altair with a koa server using [altair-koa-middleware](https://www.npmjs.com/package/altair-koa-middleware).

This is an koa middleware for mounting an instance of altair GraphQL client.

#### Installation
This is a node module and can be installed using npm:

```
npm install --save altair-koa-middleware
```

Alternatively, if you are using [`yarn`](https://yarnpkg.com/):

```
yarn add altair-koa-middleware
```

#### Usage

```js
import Koa from 'koa';
import KoaRouter from 'koa-router';
import { createRouteExplorer } from 'altair-koa-middleware';
const app = new Koa();
const router = new KoaRouter();

createRouteExplorer({
url: '/altair',
router,
opts: {
endpoint: '/graphql',
subscriptionsEndpoint: `ws://localhost:4000/subscriptions`,
initialQuery: `{ getData { id name surname } }`,
},
});

app
.use(router.routes())
.use(router.allowedMethods());

app.listen(3500);

// ... the rest of your code ...
```

An instance of Altair GraphQL Client would be available at `/altair` of your server.

0 comments on commit 17ff38d

Please sign in to comment.