Auto-generate GraphQL APIs for your databases.
Overview
I talked about generating REST APIs in 5 minutes and using GraphQL to serve machine learning models in earlier articles. GraphQL, by Facebook, is gaining popularity among developers. In this article let’s explore open-source platforms that can help us automatically generate GraphQL APIs for databases.
Setting up a PostgreSQL Database
Let’s set up a PostgreSQL database with data for demonstration purposes.
docker-compose
I am going to use the following docker-compose.yml
to set up PostgreSQL and adminer
to manage the database.
Note that I set the default network to my-network
. All the Docker instances should use the same network to communicate with each other.
The docker-compose
file and the SQL files can be found in this repository.
Run docker compose up
to create and run the Docker instances.
Adminer
Login to adminer
at http://localhost:8081
.
- System: PostgreSQL
- Server: pgsql (follow the name in
docker-compose.yml
) - Username: postgres
- Password: postgres