Skip to content

MainframeOS/graphql-fetch-schema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphql-fetch-schema

Fetch a GraphQL schema from a server and write it to file

Installation

npm install graphql-fetch-schema

CLI Usage

graphql-fetch-schema <url> [options]

Options

-h, --help                output usage information
-V, --version             output the version number
-c, --cookie              pass additional Cookie header
-g, --graphql             write schema.graphql file
-j, --json                write schema.json file
-o, --output <directory>  write to specified directory

API usage

import fetchSchema from 'graphql-fetch-schema'

fetchSchema('https://api.myserver.com/graphql', {
  json: true,
  graphql: false,
  outputPath: '../schema',
  cookie: 'cookiename=foo;',
  headers: {
    Authorization: 'Bearer token'
  }
}).then(
  () => {
    console.log('Schema successfully written')
  },
  err => {
    console.error(err)
  },
)

License

MIT

About

Fetch a GraphQL schema from a server and write it to file

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •