Building an API for Commonwealth member countries, filter results by all member countries, by region and by ISO3 Code as identified from iban
Technology Stack Documentation
-
Github: https://docs.github.com/en
-
FastAPI: https://fastapi.tiangolo.com
-
PostgreSQL: https://www.postgresql.org/docs
- Create a project repository on GitHub and add: python gitignore and creative commons licence
- Create a Heroku app and link it to the project repo
- Create the database on Heroku and obtain the connection credentials
- Using any postgres client (DBeaver) connect to the database and import the member countries' data into a new table
- Create the fastAPI code to build the API.
Base URL: https://fastapi-heroku-postgres-cw.herokuapp.com/
Endpoints:
/countries
- returns all member countries/iso/[specify_iso3]
- returns a single member country based ISO3 code, to see codes run:
curl -X GET "https://fastapi-heroku-postgres-cw.herokuapp.com/countries" -H "accept: application/json"
or go to https://fastapi-heroku-postgres-cw.herokuapp.com
/region/[specify_region]
- returns all member countries in a region, region values areAfrica, Americas, Asia, Europe or Pacific
Much appreciation and credit goes to Tse'po Melvin Thoabala
for pointing me in the right direction and Navule Pavan Kumar Rao
@tutlinks for the amazing tutorial: https://www.tutlinks.com/fastapi-with-postgresql-crud-async/
Lets connect on LinkedIn: Lehlohonolo Makoti
Learn more: Portfolio
GitHub: https://github.com/lmakoti