Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

🌍 A FastAPI-based service providing info about countries, states, and cities

alexandros-lekkas/world-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

World API 🌍

A FastAPI-based service providing info about countries, states, and cities.

Features πŸš€

  • Fetch details of countries, states, and cities.
  • Query states by country and cities by state and country.
  • Supports pagination.
  • Auto-generated Swagger documentation for testing and exploring routes.

Installation & Setup πŸ› οΈ

Prerequisites

  • Python 3.10+
  • SQLite3

Clone the Repository

git clone https://github.com/alexandros-lekkas/world-api.git
cd world-api

Create a Virtual Environment

python -m venv venv
source venv/bin/activate # For Linux/MacOS
venv\Scripts\activate # For Windows

Install Dependencies

pip install -r requirements.txt

Run the API

uvicorn api.main:app --reload

API Endpoints πŸ“‘

Countries

GET /countries?page=<int>&pageSize=<int>

GET /countriies/{iso2}

States

GET /states?page=<int>&pageSize=<int>

GET /states/{country_iso2}?page=<int>&pageSize=<int>

GET /states/details/{country_iso2}/{state_code}

Cities

GET /cities?page=<int>&pageSize=<int>

GET /cities/{state_code}?page=<int>&pageSize=<int>

GET /cities/by-country/{country_iso2}?page=<int>&pageSize=<int>

Documentation πŸ“–

By default, FastAPI enables Swagger UI and ReDoc documentation, available for testing and exploring API endpoints.

Credit πŸ‘¨β€πŸ’»

About

🌍 A FastAPI-based service providing info about countries, states, and cities

Topics

Resources

Stars

Watchers

Forks

Languages