https://github.com/mohsinraza2999/simple-sever-client-app
This FastAPI app includes a GET endpoint at / and a POST endpoint at /send to receive user input. It retrieves data from a simulated database implemented as a Python dictionary. The app uses Pydantic's BaseModel to validate input data and ensure type safety.
https://github.com/mohsinraza2999/simple-sever-client-app
basemodel fas requests-library-python unicorn
Last synced: about 1 month ago
JSON representation
This FastAPI app includes a GET endpoint at / and a POST endpoint at /send to receive user input. It retrieves data from a simulated database implemented as a Python dictionary. The app uses Pydantic's BaseModel to validate input data and ensure type safety.
- Host: GitHub
- URL: https://github.com/mohsinraza2999/simple-sever-client-app
- Owner: mohsinraza2999
- Created: 2025-04-30T12:45:03.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-03T07:19:26.000Z (12 months ago)
- Last Synced: 2025-08-03T09:09:23.850Z (12 months ago)
- Topics: basemodel, fas, requests-library-python, unicorn
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple FastAPI Server-Client App
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.
## Features
- `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.
## Requirements
- Python 3.8+
- FastAPI
- Uvicorn
Install dependencies:
## bash
pip install -r requirements.txt
Running the App
To start the server:
## bash
python server.py
## bash
uvicorn main:app --host 0.0.0.0 --port 8000
## Example Usage
### Request
POST /send
Content-Type: application/json
{
"key": "desi"
}
### Response
{
"value": "Apricote","apple"
}
## File Structure
├── server.py # Main FastAPI application
├── clients_side.ipynb # send queries and recieves responses
├── requirements.txt # Python dependencies
├── README.md # Project documentation
## License
This project is open-source and available under the MIT License.
## Author
Mohsin Raza
## yaml
---
Let me know if you want to include testing instructions, Docker support, or an OpenAPI schema section.