Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eldsonc/backend-country
Backend CountrySearch
https://github.com/eldsonc/backend-country
axios cors dotenv express nodejs typescript
Last synced: about 1 month ago
JSON representation
Backend CountrySearch
- Host: GitHub
- URL: https://github.com/eldsonc/backend-country
- Owner: EldsonC
- Created: 2024-09-14T06:27:36.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-09-14T06:42:00.000Z (2 months ago)
- Last Synced: 2024-10-15T22:04:27.688Z (about 1 month ago)
- Topics: axios, cors, dotenv, express, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 6.54 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Country Information API
## Description
This backend API allows you to fetch information about countries, including:
- All available countries.
- Specific information about a country, including borders, population, and flag.The API integrates with external services to gather data.
## Technologies Used
- **Languages**: TypeScript
- **Frameworks/Libraries**: Express, Axios
- **Other Tools**: CORS, dotenv## Installation
### Prerequisites
- **Node.js**
- **Yarn** or **npm**### Installation Steps
1. Clone the repository:
```bash
git clone https://github.com/EldsonC/backend-country.git
```2. Navigate into the project directory:
```bash
cd backend-country
```3. Install the dependencies:
```bash
yarn install
# or
npm install
```4. Create the `.env` file with the following variables:
```bash
ALL_COUNTRIES_URL="https://date.nager.at/api/v3/AvailableCountries"
COUNTRY_INFO_URL="https://date.nager.at/api/v3/CountryInfo/"
POPULATION_URL="https://countriesnow.space/api/v0.1/countries/population"
FLAGS_URL="https://countriesnow.space/api/v0.1/countries/flag/images"
PORT=3000
```5. Start the project:
```bash
yarn dev
# or
npm run dev
```## API Endpoints
### Get All Countries
**GET** `/countries`Returns a list of all available countries.
#### Response Example:
```json
[
{
"commonName": "United States",
"officialName": "United States of America"
},
{
"commonName": "Brazil",
"officialName": "Federative Republic of Brazil"
}
]