A FastAPI application for managing items with admin authentication.
- Admin authentication using JWT tokens
- Create items (admin only)
- List items (public)
- Install dependencies:
pip install -r requirements.txt- Run the application:
uvicorn app.main:app --reloadGet admin token:
curl -X POST "http://localhost:8000/auth/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin&password=admin123"Create item (requires admin token):
curl -X POST "http://localhost:8000/items/" \
-H "Authorization: Bearer <your-token>" \
-H "Content-Type: application/json" \
-d '{"title": "Test Item", "description": "Test Description", "price": 10.0}'List all items (public):
curl "http://localhost:8000/items/"- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc