How to do it...

Let's create our first GraphQL server:

  1. First, we need to create an index.js file for our Express server:
  import express from 'express';  const app = express();  app.listen(3000, () => console.log('Running server on port 3000'));
File: index.js
  1. If you run babel-node index.js in your terminal, you should be able to see the node server running on port 3000:
  1. Now we need to include our express-graphql library and import the buildSchema method from graphql:
    import express from 'express';    import expressGraphQL from 'express-graphql';    import { buildSchema } from 'graphql';    const app = express();    app.listen(3000, () => console. ...

Get React Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.