For this recipe, we are going to create a contacts list in which we will save the name, phone, and email addresses of our friends.
Creating our first GraphQL server
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