Skip to content

kadirahq/graphqlify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphqlify

This module helps you build GraphQL queries using plain JavaScript objects. This can be useful when you need to programmatically build GraphQL queries. Install the module from npm to get started.

npm i -S graphqlify

Example

GraphQL

{
  teamFourStar {
    members {
      memberName
    }
    saiyans: members(type: SAIYAJIN, minPower: 9000) {
      memberName
      powerLevel
    }
  }
}

JavaScript

import graphqlify, {Enum} from 'graphqlify';

const string = graphqlify({
  teamFourStar: {
    fields: {
      members: {
        fields: {memberName: {}}
      },
      saiyans: {
        field: 'members',
        params: {type: Enum('SAIYAJIN'), minPower: 9000},
        fields: {memberName: {}, powerLevel: {}}
      }
    }
  }
});

About

Build GraphQL queries with JavaScript

Resources

Stars

Watchers

Forks

Packages

No packages published