ql-schema-middleware
v1.0.0
Published
A middleware for generating your GraphQL schema.json file for relay.
Downloads
14
Readme
ql-schema-middleware
A middleware for generating your GraphQL schema.json file for relay.
"Inspired" by this script: relay-starter-kit/scripts/updateSchema.js.
Installation
npm install ql-schema-middleware
Usage
Use with express:
import {
graphql
GraphQLSchema,
} from 'graphql';
import express from 'express';
import qlSchemaMiddleware from 'ql-schema-middleware';
const schema = new GraphQLSchema({
query: ...
});
const server = express();
server.use('/schema', qlSchemaMiddleware(graphql, schema));
server.listen(3000);
console.log(`Alive and well on port: 3000`);
Or curl & pipe to a file:
curl http://localhost:3000/schema -o schema.json