Country Info Explorer is a simple web app that allows you to explore information about countries around the world. You can view all countries or search for a specific country to see details such as population, currencies, and regions.
- View a list of all countries with their population and currencies.
- Search for a specific country and view its details.
- View statistics including total countries, total population, and average population.
- View a table of regions and the number of countries in each region.
- A modern web browser
- An internet connection
- Clone the repository to your local machine:
git clone link_to_your_repository
- Open the
index.html
file in your web browser.
- Click the "View All Countries" button to display information about all countries.
- Enter a country name in the search box and click the "Find Country" button to search for a specific country.
- View statistics about total countries, total population, and average population.
- View a table of regions and the number of countries in each region.
async function displayData(url) {
const response = await fetch(url);
const data = await response.json();
// Process and display the data...
}
document.getElementById("findCountry").addEventListener("click", async function (event) {
event.preventDefault();
const countryName = document.getElementById("countrySearch").value.trim();
if (isValidCountryName(countryName)) {
displayData("https://restcountries.com/v3.1/name/" + countryName);
} else {
alert("Please enter a valid country name.");
}
});
function isValidCountryName(countryName) {
return /^[a-zA-Z]+$/.test(countryName);
}
This project uses the Rest Countries API to fetch country data.
- GET
https://restcountries.com/v3.1/all
- Retrieves data about all countries. - GET
https://restcountries.com/v3.1/name/{country_name}
- Retrieves data about a specific country.
Contributions are always welcome! Please read the contribution guidelines first.
This project is open-source and available under the MIT License.
If you have any questions or want to reach out to the author, you can contact them at [your_email@example.com].
- Thank you to the Rest Countries API for providing the data used in this project.