Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Le Cam committed Nov 3, 2016
1 parent 66bde56 commit 9cfb1bb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

Fetch a GraphQL schema from a server and write it to file

## Usage
## Installation

```sh
npm install graphql-fetch-schema
```

## CLI Usage

```sh
graphql-fetch-schema <url> [options]
Expand All @@ -18,6 +24,24 @@ graphql-fetch-schema <url> [options]
-o, --output <directory> write to specified directory
```

### API usage

```js
import fetchSchema from 'graphql-fetch-schema'

fetchSchema('https://api.myserver.com/graphql', {
json: true,
graphql: false,
outputPath: '../schema',
})
.then(() => {
console.log('Schema successfully written')
})
.catch((err) => {
console.error(err)
})
```

## License

MIT
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"clean": "rm -rf ./lib",
"compile": "babel src --out-dir lib",
"build": "npm run clean && npm run compile",
"start": "npm run compile"
"start": "npm run compile",
"prepublish": "npm ls && npm start"
},
"author": "Paul Le Cam <[email protected]>",
"license": "MIT",
Expand Down

0 comments on commit 9cfb1bb

Please sign in to comment.