This is a simple FastAPI backend for onboarding member registration with basic authentication. It is intended for testing and learning purposes.
- Register new members
- Authenticate users
- Read member info
- Update member info
- Delete member info
- Python 3.10+
- Install dependencies:
pip install -r requirements.txt
POST /create
Body (JSON):
{
"first_name": "John",
"last_name": "Doe",
"user_name": "johndoe",
"phone": "1234567890",
"email": "john@example.com",
"tin": 123456,
"password": "yourpassword"
}Curl Example:
curl -X POST http://localhost:8000/create \
-H "Content-Type: application/json" \
-d '{"first_name":"John","last_name":"Doe","user_name":"johndoe","phone":"1234567890","email":"john@example.com","tin":123456,"password":"yourpassword"}'POST /read/{user_name}
Curl Example:
curl -X POST http://localhost:8000/read/johndoePOST /update/{user_name}/{field}
Body (JSON):
{
"password": "yourpassword"
}Query Parameter: value (new value for the field)
Curl Example:
curl -X POST "http://localhost:8000/update/johndoe/phone?value=0987654321" \
-H "Content-Type: application/json" \
-d '{"password":"yourpassword"}'POST /delete/{user_name}
Body (JSON):
{
"password": "yourpassword"
}Curl Example:
curl -X POST http://localhost:8000/delete/johndoe \
-H "Content-Type: application/json" \
-d '{"password":"yourpassword"}'POST /authenticate/{user_name}
Body (JSON):
{
"password": "yourpassword"
}Curl Example:
curl -X POST http://localhost:8000/authenticate/johndoe \
-H "Content-Type: application/json" \
-d '{"password":"yourpassword"}'- All endpoints use POST for simplicity.
- Passwords are stored as SHA256 hashes.
- For testing, run the server with:
uvicorn main:app --reload
Made for onboarding and testing purposes.