0.7.4 • Published 7 months ago

graphql-inquirer v0.7.4

Weekly downloads
1
License
MIT
Repository
github
Last release
7 months ago

GraphQL Inquirer

A visual data browser for GraphQL APIs.

Disclaimer:
This project is still under development and may not perform as expected. Use at your own risk.

Use

Install via NPM

$ npm install graphql-inquirer

Note You must npm install --save react-router-dom@5.0.0 in the parent project, or manually in this project if you are running the example. This is because react-router-dom needs to be a peer dependency to not conflict with the parents installation when using in a routed app.

Set up a fetcher function. It must point to a valid introspectable GraphQL API, take a query as input and return a Promise.

// with Fetch API
function MyFetcher(query) {

  var request_options = {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(query)
  }

  return fetch('url://to.your.api', request_options).then((response) => (response.json()));
}

Import and render with React

import React from 'react';
import ReactDOM from 'react-dom'

import GraphQLInquirer from 'graphql-inquirer';

ReactDOM.render(<GraphQLInquirer fetcher={MyFetcher} />, document.getElementById('my-root-component'))

Using with an existing React Router

If you already have a React Router set up in yout project, just add isInARouter as a prop:

const RoutedApp = (
  <HashRouter>
    <Route path="/stuff/" component={() =>
      <Inquirer fetcher={MyFetcher} isInARouter />
    } />
  </HashRouter>
)

ReactDOM.render(RoutedApp, document.getElementById('my-root-component'))

Development

  1. Clone or fork the repository and run $ npm install

  2. Run $ npm run serve to start Webpack Dev Server

  3. Do your thing

  4. Run $ npm run build to build the project

0.7.4

7 months ago

0.7.3

2 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.0

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago