Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

An example showing how to generate GraphQL bindings for GraphQL APIs generated by Hasura GraphQL Engine

Notifications You must be signed in to change notification settings

hasura/generate-graphql-bindings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate graphql-bindings from Hasura GraphQL Engine APIs

This repo shows how to generate graphql-bindings for Hasura GraphQL Engine generated APIs.

Configuration

  1. Clone the repo and cd into it.

    $ git clone https://github.com/hasura/generate-graphql-bindings && cd generate-graphql-bindings
  2. Place your GraphQL schema in the root directory. To generate your GraphQL schema, you can run the following two commands from the root directory:

    $ npm install -g get-graphql-schema
    $ get-graphql-schema GRAPHQL_URL > schema.graphql
    
    # replace GRAPHQL_URL with your GraphQL URL such as `https://test.herokuapp.com/v1alpha1/graphql`

    If you have set an ACCESS_KEY for the GraphQL engine, you need to pass a header while generating the schema.

  3. Set your GraphQL Engine URL in index.js as:

    // replace 'http://tanmai .....' with your GraphQL engine URL
    const graphqlEndpoint = 'http://tanmai-graphql2.herokuapp.com/v1alpha1/graphql';
  4. You can export this binding and start using it. For example:

    import HasuraBinding from './bindigs/';
    
    const newBinding = new HasuraBinding();
    newBinding.query.article(args, '{ id, title, content }').then((response) => console.log(response));

Usage

To know about using GraphQL bindings, read the docs.

About

An example showing how to generate GraphQL bindings for GraphQL APIs generated by Hasura GraphQL Engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages