Let's create our first GraphQL server:
- 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
- If you run babel-node index.js in your terminal, you should be able to see the node server running on port 3000:
- 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. ...