Welcome to the Free Country API! This API provides information about various countries, including details like country names and country codes.
This API is designed to offer free access to country-related data, allowing developers to retrieve information about different countries.
To use this API, follow these steps:
- Clone the repository:
git clone https://github.com/Fadilix/country-api.git
- Install dependencies:
npm install
- Start the server:
npm start
Make requests to the specified endpoints to retrieve information about countries.
- URL:
/api/countries
- Method:
GET
- Description: Retrieve a list of all countries.
- Example response:
{
"data": [
{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Åland Islands",
"code": "AX"
},
{
"name": "Albania",
"code": "AL"
}
// other countries...
]
}
- URL:
/api/countries/:countryName
- Method:
GET
- Description: Retrieve information about a specific country by its name.
- Example response:
{
"data": [
{
"name": "Canada",
"code": "CA"
}
]
}
- URL:
/api/countries/code/:countryCode
- Method:
GET
- Description: Retrieve information about a specific country by its country code.
- Example response:
{
"data": [
{
"name": "Albania",
"code": "AL"
}
]
}