Creating our GraphQL backend server

Let's get started with the backend server:

  1. First, inside the apollo project (the one we created with create-react-app), we need to create a new directory called backend, initialize a package.json file, and create inside the src folder:
      cd apollo      mkdir backend      cd backend      npm init -y      mkdir src
  1. Now we need to install these dependencies:
      npm install cors express express-graphql graphql graphql-tools       mongoose nodemon babel-preset-es2015      npm install -g babel-cli
  1. In our package.json file, we need to modify our start script to use nodemon:
      "scripts": {        "start": "nodemon src/app.js --watch src --exec babel-node         --presets es2015"      }
File: package.json
  1. Then we need to create our app.js file, in which ...

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.