Get social and geographical information about all the sovereign countries in the world!
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
Ever wondered what side of the street people drive on in Brazil? Now you can get that interesting fact along with may others using Countries of the World API.
Countries of the World is an API that serves social and geographical information about all of the countries in the world.
All relevant information about the API such as countries available, endpints, and api properties can be found in the documentation.
Some countires may not have all property data. Unavailable data properties are represented by an empty value. e.g. empty string values are ''
, empty array values are []
.
- Two Endpoints: country look up, entire api collection
- Ten data properties:
capital
,wikiLink
,flag
,gini
,gdp
,population
,drivingSide
,currency
,countryName
,officialLanguages
- 195 Countries
Data contained in the Countries of the World API was scraped from Wikipedia using the Axios and Cheerio modules. Data retained is stored in a file on server and used to serve information via the API endpoints. The API is built with the following technologies:
If you would like to use the Countries of the World API, refer to the documentation to get started.
To get a local copy of the API up and running follow these simple example steps.
Follow the steps below to set up the API locally.
- Clone the repo
git clone https://github.com/tdo95/countries-of-the-world-api.git
- Install NPM packages
npm install
- Optional: Uncomment the
scrapeData
function on line 50 within theserver.js
to re- build the database file used within the API// RUN FUNCTION TO SCAPE WIKIPEDIA FOR COUNTRIES DATA scrapeData();
- To start the API server, run the following command
Alternatively, you can run with nodemon
npm run start
npm run dev
- Add ISO and sign to currency property
- Incoorporate pre-existing data in the world-countries database
- How to use logic to traverse webpages with inconsistent document structures
- Remove accent marks from text using the
normalize()
andreplace()
methods - Scrapping across sites without standardized document structures is difficult and ineffienct, should look into how to approach this effectively
- Build scraping function for contries database
- build out logic for each endpoint
- Refractor fillInData() function into smaller parts for readability
- Clean up inputs for GDP and Population
Portfolio: www.github.com/tdo95