Git Product home page Git Product logo

json-graphql-parser's Introduction

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

Table of Contents

Note V1 template will be deprecated soon. Use V2 instead.

Playground

Visit https://jgpp.koustov.com/

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",
    return:     "[Required | String Array]: Array parameters to return"
}

Clause

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

Schema

Check the object schema here

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

json-graphql-parser's People

Contributors

koustov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.