Skip to content

Commit

Permalink
Experimenting (#3843)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-allanson authored and KyleAMathews committed Feb 6, 2018
1 parent d35eef0 commit 014bda5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/gatsby/src/commands/data-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@
const express = require(`express`)
const graphqlHTTP = require(`express-graphql`)
const { store } = require(`../redux`)
const bootstrap = require(`../bootstrap`)
const { GraphQLSchema } = require(`graphql`)

// Note: the store must exist already. Create it with `gatsby build`.
module.exports = async (program: any) => {
let { port, host } = program
port = typeof port === `string` ? parseInt(port, 10) : port

// bootstrap to ensure schema is in the store
await bootstrap(program)

const schema = store.getState().schema

console.log(
`Schema is instance of GraphQLSchema?`,
schema instanceof GraphQLSchema
)

const app = express()
app.use(
`/`,
graphqlHTTP({
schema: store.getState().schema,
schema,
graphiql: true,
})
)
Expand Down

0 comments on commit 014bda5

Please sign in to comment.