Use as a library

Generate Code

This will be rarely used, but here you are! Generate Typescript and Javascript from GraphQL definitions:

import { TreeToTS } from 'graphql-zeus';
import { Parser } from 'graphql-js-tree';

const schemaFileContents = `
type Query{
    hello: String!
    query: Query

const typeScriptDefinition = TreeToTS.resolveTree(Parser.parse(schemaFileContents));

Dynamically Fetch Schema

This is useful when you need your schema fetched from your GraphQL endpoint in-code:

import { Utils } from 'graphql-zeus';

Utils.getFromUrl('').then((schemaContent) => {
  // Use schema content here

Last updated