🌍 A simple and powerful API for accessing information about countries around the world.
- Get information about all countries
- Filter countries by continent
- Retrieve random countries
- Get detailed information about a specific country
- Combine filters for more specific queries
You can test the API without any setup using our live version hosted on Render:
https://countries-api-ctn3.onrender.com
Feel free to use this URL to make API calls and test the functionality before setting up your local environment.
- Node.js (v14.0.0 or higher)
- npm (v6.0.0 or higher)
-
Clone the repository:
git clone https://github.com/yourusername/countries-api.git
-
Navigate to the project directory:
cd countries-api
-
Install dependencies:
npm install
-
Start the server:
npm start
The API should now be running on http://localhost:3000
.
/data
: Get all countries/data?continent=<continentName>
: Get countries from a specific continent/data?random=<count>
: Get a random selection of countries/data?country=<countryName>
: Get information about a specific country/data?continent=<continentName>&random=<count>
: Get a random selection of countries from a specific continent
You can use either the live API URL or your local server for these examples.
-
Get all countries:
GET https://countries-api-ctn3.onrender.com/data
-
Get countries from Europe:
GET https://countries-api-ctn3.onrender.com/data?continent=Europe
-
Get 5 random countries:
GET https://countries-api-ctn3.onrender.com/data?random=5
-
Get information about Afghanistan:
GET https://countries-api-ctn3.onrender.com/data?country=Afghanistan
-
Get 3 random countries from Asia:
GET https://countries-api-ctn3.onrender.com/data?continent=Asia&random=3
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Data sourced from List of countries - Wikipedia
- Built with Express.js
- Hosted on Render