Entry Point

Using standard GraphQL library

We can execute graphql just by using it's library for example:

var { graphql, buildSchema } = require("graphql")

var schema = buildSchema(`
  type Query {
    hello: String
  }
`)

var rootValue = { hello: () => "Hello world!" }

var source = "{ hello }"

graphql({ schema, source, rootValue }).then(response => {
  console.log(JSON.stringify(response))
})

We just need:

  • Schema: schema
  • Resolvers: rootValue
  • Query: source

Using this fundamental, we can manually expose our own endpoint using express and customise our endpoint to call the above function.