Example from https://www.apollographql.com/docs/apollo-server/getting-started/
To run locally
npm run start
npm run compile && node --experimental-modules --es-module-specifier-resolution=node ./dist/src/index.js
For testing, you can use the following command:
npm run compile
npm run test
Then, open your browser to http://localhost:4000/
to see the result.
in the operation field, you can use the following query to get the data from the server:
query GetBooks {
books {
title
author
}
}
to see this result
{
"data": {
"books": [
{
"title": "The Awakening",
"author": "Kate Chopin"
},
{
"title": "City of Glass",
"author": "Paul Auster"
}
]
}
}