ExpressJsGraphQL with Express

Integrate GraphQL into your Express app to create flexible APIs with strongly typed schemas and resolvers.

npm install express-graphql graphql

const { graphqlHTTP } = require('express-graphql');
const { buildSchema } = require('graphql');

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

const root = { hello: () => 'Hello, GraphQL!' };

app.use('/graphql', graphqlHTTP({ schema, rootValue: root, graphiql: true }));