graphql-fetch-schema

1.1.0 • Public • Published

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

/graphql-fetch-schema/

    Package Sidebar

    Install

    npm i graphql-fetch-schema

    Weekly Downloads

    187

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    7.92 kB

    Total Files

    7

    Last publish

    Collaborators

    • aclarke
    • diogoperillo
    • howleysv
    • mosic
    • paul_lecam
    • sarahwiley