/json-graphql-parser

A simple way to create and parse graphql query on node application

Primary LanguageJavaScriptMIT LicenseMIT

json-graphql-parser

A simple way to create and parse graphql query on node application

Building graphql query is just an API away.
No graphql knowledge is required.


GitHub watchers GitHub watchers GitHub watchers GitHub watchers

This is a fully customizable form builder based on React

Table of Contents

Install

    npm install json-graphql-parser axios
    # or
    yarn add json-graphql-parser axios

Usage

  1. Import ES6
    // ES6
    import {submit} from 'json-graphql-parser'
    
    // ES5
    const {submit} = require('json-graphql-parser')
  2. Usage
    submit(query_config, url, additional_header)

Query Configuration

Basic Query

{
    display:    "[Optional | String]: Give a display name for the query",
    name:       "[Optional | String]: Query name",
    function:   "[Required | String]: Target function name",
    write:      "[Optional | Boolean]: Whether the current one is a write query",
    params:     "[Required | String Array]: Array parameters to return"
}

Clause

{
    where: {
        class:      "[Optional | String] Target class name",
        node:       "[Required | String] Target node",
        operator:   "[Optional | String] Operator type (or/and)",
        clause: [{
            field:      "[Required | String]: Field in question",
            operator:   "[Required | String] Operator (eq | ne | in | ...)",
            value:      "[Required | String] Value to match",
            type:       "[Optional | String] Value type",
            class:      "[Optional | String] Target class name",
            node:       "[Required | String] Target node",
        }],
    },
}

Examples

A bunch of examples has been given under queries from an outstanding open source application called reactplay

Contribution 🍰

Feel free to create issue and make pull request

Refer code of conduct

Refer contributing

License

MIT © Koustov