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