An open API service indexing awesome lists of open source software.

https://github.com/charlypoly/generic-graphql

Generic GraphQL Wrapper for Rest API
https://github.com/charlypoly/generic-graphql

graphql node-module rest-api typescript-library

Last synced: about 1 year ago
JSON representation

Generic GraphQL Wrapper for Rest API

Awesome Lists containing this project

README

          

# generic-graphql

> Generic GraphQL Wrapper for Rest API

--------------------

### Design goal

```typescript

let schema = `
type Artist {
id: String
name: String
popularity: Int
type: String
}
`;

let configuration = {
root: 'http://myapi.com/api/v1',
oAuth: false,
inferRessourceFromTypes: true,
generateQueries: true
};

let client: GenericGraphQLClient = new GenericGraphQL({
adapter: new GenericGraphQLCRUD(configuration)
});

let query = `{
query {
artist($id: 1) {
name
}
}
}`;

// call `http://myapi.com/api/v1/artists/1`
client.query(query, (executionResult) => {

});

```

#### Dependencies
- istanbul
- mocha
- request
- graphql-tools
- lodash ?
- when ?