Skip to content

Commit

Permalink
feat: Convert project to ES5 so it can run in the browser. Using webp…
Browse files Browse the repository at this point in the history
…ack, eslint and babel + adding support for browser testing
  • Loading branch information
nicolasdao committed Jun 13, 2017
1 parent fd8c95f commit 4bfbb77
Show file tree
Hide file tree
Showing 13 changed files with 26,529 additions and 510 deletions.
Binary file added .DS_Store
Binary file not shown.
19 changes: 15 additions & 4 deletions README.md
Expand Up @@ -10,13 +10,21 @@
[4]: https://travis-ci.org/nicolasdao/graphql-s2s

## Install
#### node
```js
npm install 'graphql-s2s' --save
```
#### browser
After installing the _graphql-s2s_ npm package, you can reference it as follow in your HTML page:
```html
<script src="./node_modules/graphql-s2s/lib/graphqls2s.min.js"></script>
```
The API will be accessible through the __*graphqls2s*__ object.

## Usage
```js
const { transpileSchema } = require('graphql-s2s');
const graphqls2s = require('graphql-s2s');
const { transpileSchema } = graphqls2s;
const { makeExecutableSchema } = require('graphql-tools');

const schema = `
Expand Down Expand Up @@ -190,7 +198,8 @@ type Student inherits Person {
__*Full code example*__

```js
const { transpileSchema } = require('graphql-s2s');
const graphqls2s = require('graphql-s2s');
const { transpileSchema } = graphqls2s;
const { makeExecutableSchema } = require('graphql-tools');
const { students, teachers } = require('./dummydata.json');

Expand Down Expand Up @@ -371,7 +380,8 @@ type PagedQuestion {
__*Full code example*__

```js
const { transpileSchema } = require('graphql-s2s');
const graphqls2s = require('graphql-s2s');
const { transpileSchema } = graphqls2s;
const { makeExecutableSchema } = require('graphql-tools');
const { students, teachers } = require('./dummydata.json');

Expand Down Expand Up @@ -440,7 +450,8 @@ const executableSchema = makeExecutableSchema({
### Metadata Decoration
Define your own custom metadata and decorate your GraphQL schema with new types of data. Let's imagine we want to explicitely add metadata about the type of relations between nodes, we could write something like this:
```js
const { getSchemaAST } = require('graphql-s2s');
const graphqls2s = require('graphql-s2s');
const { getSchemaAST } = graphqls2s;
const schema = `
@node
type User {
Expand Down

0 comments on commit 4bfbb77

Please sign in to comment.