UNPKG

1.5 kBMarkdownView Raw
1# cloudapi-gql
2
3[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
4
5[![Build Status](https://secure.travis-ci.org/joyent/cloudapi-gql.svg)](http://travis-ci.org/joyent/cloudapi-gql)
6
7
8hapi plugin that exposes [CloudApi](https://apidocs.joyent.com/cloudapi/) through
9[GraphQL](http://graphql.org).
10
11## Table of Contents
12
13* [Install](#install)
14* [Options](#options)
15* [Usage](#usage)
16
17## Install
18
19```
20npm install cloudapi-gql
21```
22
23## Options
24
25- `authStrategy`: name of the hapi auth strategy to use for `/graphql` route
26- `keyPath` private key file path for the key associated with Triton account
27- `keyId`: string in the form of `/${SDC_ACCOUNT}/keys/${SDC_KEY_ID}`
28- `apiBaseUrl`: cloud API base URL to connect to
29
30
31## Usage
32
33```js
34const server = new Hapi.Server();
35await server.register({ plugin: CloudApiGQL, options: { authStrategy, keyPath, keyId, apiBaseUrl } });
36```
37
38
39### Local development
40
41```
42npm run dev
43```
44
45* [GraphiQL](http://0.0.0.0:4000/graphiql)
46* [Graphidoc](http://0.0.0.0:4000/doc)
47* [Voyager](http://0.0.0.0:4000/voyager)
48* [Playground](http://0.0.0.0:4000/playground)
49
50![](https://cldup.com/StGgfIbD3N.png) ![](https://cldup.com/fhpul_AJ13.png)
51![](https://cldup.com/A-VwSbvWBe.png) ![](https://cldup.com/08P360Skhx.png)
52
53```
54npm run faker
55```
56
57* [GraphQL Faker Interactive Editor](http://0.0.0.0:9002/editor)
58* [GraphQL Faker API](http://0.0.0.0:9002/graphql)
59
60![](https://cldup.com/VWadVMorQ0.png)
61