This is a lightweight FastAPI-based server-client application. It demonstrates basic API handling with GET and POST endpoints, data validation using Pydantic, and dictionary-based data retrieval simulating a database.
GET /— Basic endpoint to test server availability.POST /send— Accepts user input and retrieves corresponding data.- Uses Python dictionary as a mock database.
- Validates request data with Pydantic's
BaseModel. - Lightweight and suitable for learning or quick prototyping.
- Python 3.8+
- FastAPI
- Uvicorn
Install dependencies:
pip install -r requirements.txt Running the App To start the server:
python server.py
uvicorn main:app --host 0.0.0.0 --port 8000
POST /send Content-Type: application/json
{ "key": "desi" }
{ "value": "Apricote","apple" }
├── server.py # Main FastAPI application
├── clients_side.ipynb # send queries and recieves responses
├── requirements.txt # Python dependencies
├── README.md # Project documentation
This project is open-source and available under the MIT License.
Mohsin Raza
Let me know if you want to include testing instructions, Docker support, or an OpenAPI schema section.