This project is one of the components of the pjx
application, please check pjx-root for more details.
- pjx-api-node - the API that this Apollo Server is consuming
For the real world problems, GraphQL is a powerful tool for a more complex infrastructure, such that a company with many differenct API endpoints, or an API have complex schema for many different scenarios, therefore many different variations to return data even on the same endpoint. There are a lot of discussions on the internet about when to use or not to use GraphQL, so, depending on your point of view, it might be overkilled to use GraphQL to connect to one and only one simple API gateway in my demo project. I am using GraphQL here only for demo purpose.
Ensure you have Docker installed and running on you local machine.
Run the following in the command line from the root of the pjx-graphql-apollo project.
docker-compose up
This will run a local graphql server in a docker container, can be reached at http://localhost:4000.
Sample queries that you may try:
{
cities {
id
name
city
}
}
{
city(id:"1"){
id
name
city
}
}
To stop the local server (container) run the following:
docker-compose down