Table of Contents
Locale is a developer tool for anyone who needs to know Nigeria geographically. Locale's API shows you all of Nigeria's regions, states, and local government areas (LGAs). Locale is looking to be a handful tool for the thousands of businesses building for Nigeria's 200M+ population size.
This project was built with Python's Flask-RESTX by Barakat Adisa as part of Backend Engineering final Semester Exam and Capstone Project at AltSchool Africa
By creating this API, I was able to learn and understand the following concepts:
- Caching
- App Deployment with Render
- MongoDB
- Documentation
- Debugging
- Routing
- Database Management
- Rate Limiting
- File Handling
- Redis
- User Authentication
- User Authorization
-
Clone the repo
git clone https://github.com/Adekemi02/locale_api
-
Navigate to the project directory
cd locale_api
-
Create a virtual environment
python -m venv venv
-
Install the required packages
pip install -r requirements.txt
-
Run the app
flask run
-
Open the app in your preferred browser by visiting: http://localhost:5000.
To make use of this API, simply follow the following steps:
-
Open the app in your preferred browser by visiting: https://locale-2o8b.onrender.com.
-
Create a user account to unlock the full potential of the API.
-
Register as a user by clicking on 'auth' to reveal the dropdown menu for authentication and authorization. You can easily register via the 'api/v1/auth/register' route.
-
Once registered, sign in using the 'api/v1/auth/login' route to generate a JWT token. This token will grant you access to the API. Copy the jwt_token without quotation marks.
-
Scroll up and click on "Authorize" located at the top right corner. Enter your JWT token in the following format:
Bearer thejwt_token
-
Click 'Authorize' and then 'Close' to securely authenticate yourself.
-
Now that you are authorized, a world of possibilities awaits! The API provides the following endpoints to cater to your needs:
- GET /api/v1/states: Retrieve a comprehensive list of all states within Nigeria.
- GET /api/v1/regions: Discover all geopolitical zones within Nigeria.
- GET /api/v1/lgas: Access information on all Local Government Areas (LGAs) within each state.
- GET /api/v1/lgas/{state_id}: Retrieve all local government areas within a specific state.
- GET /api/v1/regions/{region_id}: Gather in-depth details about an individual region, including its associated states.
- GET /api/v1/states/{state_id}: Obtain specific information about a single state, along with its metadata.
- GET /api/v1/search/{query}: Effortlessly search for a region or state by name or ID.
-
When you have completed your API interactions, simply click 'Authorize' once again at the top right corner and proceed to click 'Logout' for a secure and seamless logout experience.
Distributed under the MIT License. See LICENSE for more information.
Barakat Adisa - @adisa_adekhemie - [email protected]
Project Link: LOCALE API
This project was made possible by: