Getting ready

The first thing we need to do is to create a directory for our project and initialize a new package.json file installing express, graphql, and express-graphql:

  mkdir contacts-graphql  cd contacts-graphql  npm init --yes  npm install express graphql express-graphql babel-preset-env  npm install -g babel-cli

We need to install babel-preset-env and babel-cli to use ES6 syntax in Node. Also, we need to create a .babelrc file :

  {    "presets": ["env"]  }
File: .babelrc

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.