Skip to content

Commit

Permalink
Improve README
Browse files Browse the repository at this point in the history
* Examples
* Screenshot
* Switch to Markdown for NPM's sake
  • Loading branch information
mhallin committed May 6, 2016
1 parent edd5fda commit ac918f9
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 13 deletions.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# GraphQL Documentation Explorer

Dynamically generated documentation explorer for [GraphQL](http://graphql.org)
schemas. It aims to provide a better overview of a schema than
[GraphiQL](https://github.com/graphql/graphiql), but without querying features.

[![Build Status](https://travis-ci.org/mhallin/graphql-docs.svg?branch=master)](https://travis-ci.org/mhallin/graphql-docs)
[![npm](https://img.shields.io/npm/v/graphql-docs.svg?maxAge=2592000)](https://www.npmjs.com/package/graphql-docs)

---

![Example Screenshot](docs/example.png)

## Installation and usage

GraphQL-Docs tries to work similarly to GraphiQL in most areas. Either use the
minified files from GitHub:

```html
<script src="https://github.com/mhallin/graphql-docs/releases/download/v0.1.2/graphql-docs.min.js"></script>
<!-- Note that you need to include React and ReactDOM *before* this script tag -->
```

Or download it into your own package via NPM:

```sh
npm install --save graphql-docs
```

GraphQL-Docs exposes a single React component that requires a function to run a
query against a server and return a `Promise` with the result:

```javascript
function fetcher(query) {
return fetch(window.location.origin + '/graphql', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: query,
}),
}).then(function(r) {
return r.json();
});
}

ReactDOM.render(<GraphQLDocs.GraphQLDocs fetcher={fetcher} />, document.body);
```

All CSS is included in the Javascript code, so no other dependencies are
required. You can find examples of both the first and second paradigms in the
examples folder.

## Features

* Markdown rendered documentation (using
[Marked](https://github.com/chjj/marked)).
* All types and fields are recursively searched from the schema's root query and
mutation objects. Types that can't be queried are not included.
* Field arguments listed in separate tables in the cases where they *do* contain
a description.

### Planned features

* Improved layout with some sort of navigation
* On-page search
13 changes: 0 additions & 13 deletions README.rst

This file was deleted.

Binary file added docs/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ac918f9

Please sign in to comment.