# Find Naija API
Find Naija API is a capstone project developed by AltSchool Africa. It is built using TypeScript and Express, running on Node.js. The API provides endpoints for searching regions, states, and LGAs (Local Government Areas) in Nigeria.
**Table of Contents**
- Introduction
- API Endpoints
- Getting Started
- Authentication
- Error Handling
- Pagination
- Sorting
- Filtering.
-
# Introduction
The Find Naija API allows users to retrieve information about regions, states, and LGAs in Nigeria. It provides various endpoints to facilitate searching and retrieving data. The API is implemented using Express and TypeScript, and it communicates with a MongoDB database.
## API Endpoints
# Search
**Get all regions**
- URL: /api/search/regions
- Method: GET
- Description: Retrieves a list of all regions in Nigeria.
- Authorization: Requires an API key (X-API-KEY header).
**Get states by region**
- URL: /api/search/state-by-region/{region}
- Method: GET
- Description: Retrieves a list of states in the specified region.
- Parameters:
- region (path parameter): The name of the region.
- Authorization: Requires an API key (X-API-KEY header).
**Get LGAs by state**
- URL: /api/search/lga-by-state/{state}
- Method: GET
- Description: Retrieves a list of LGAs in the specified state.
- Parameters:
- state (path parameter): The name of the state.
- Authorization: Requires an API key (X-API-KEY header).
**Get all states with pagination**
- URL: /api/search/states
- Method: GET
- Description: Retrieves all states with pagination support.
- Parameters:
- sortBy (query parameter, optional): Sort states by field(s) (comma-separated). Use "-" prefix for descending order.
- fields (query parameter, optional): Specify fields to include (comma-separated).
- Authorization: Requires an API key (X-API-KEY header).
**Get information about a specific state**
- URL: /api/search/state/{state}
- Method: GET
- Description: Retrieves information about a specific state.
- Parameters: …