Skip to content

tdo95/countries-of-the-world-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Countries of the World API

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
  1. About The Project
  2. Getting Started
  3. Optimizations
  4. Roadmap
  5. Contact
  6. Acknowledgments

About The Project

Countries of the World Demo

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.

About The API

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 [].

Features

  • Two Endpoints: country look up, entire api collection
  • Ten data properties: capital, wikiLink, flag, gini, gdp, population, drivingSide, currency, countryName, officialLanguages
  • 195 Countries

How Its Made

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:

HTML CSS JavaScript Node Express Axios Cheerio

Getting Started

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.

Installation

Follow the steps below to set up the API locally.

  1. Clone the repo
    git clone https://github.com/tdo95/countries-of-the-world-api.git
  2. Install NPM packages
    npm install
  3. Optional: Uncomment the scrapeData function on line 50 within the server.js to re- build the database file used within the API
    // RUN FUNCTION TO SCAPE WIKIPEDIA FOR COUNTRIES DATA
    
    scrapeData();

Usage

  1. To start the API server, run the following command
     npm run start  
    Alternatively, you can run with nodemon
     npm run dev  

Optimizations

Future Improvements

  • Add ISO and sign to currency property
  • Incoorporate pre-existing data in the world-countries database

Lessons Learned

  • How to use logic to traverse webpages with inconsistent document structures
  • Remove accent marks from text using the normalize() and replace() methods
  • Scrapping across sites without standardized document structures is difficult and ineffienct, should look into how to approach this effectively

Roadmap

  • 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

Contact

Tee O.

Portfolio: www.github.com/tdo95 Email

(back to top)

About

🌎 An API that serves social and geographical information about the countries in the world!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published