A simple FastAPI-based fake API for testing purposes. This project provides mock endpoints for users, posts, and items to simulate a REST API.
- Python >= 3.13
- Poetry (for dependency management)
-
Install dependencies:
poetry install
-
Set Python version if needed:
poetry env use python3.13
-
Run the API server:
poetry run uvicorn src.main:app --port 8000 --reload
The API will be available at
http://localhost:8000.
- GET /: Welcome message.
- GET /items/{item_id}: Get an item by ID. Optional query parameter
q. - GET /users: List all users.
- GET /users/{user_id}: Get a specific user by ID.
- GET /posts: List all posts.
- GET /posts/{post_id}: Get a specific post by ID.
- Linting: Run
poetry run black src/andpoetry run isort src/. - Testing: Run
poetry run pytest. - Lint checks: Run
poetry run flake8 src/.
src/main.py: Main FastAPI application with endpoints.tests/: Test files.pyproject.toml: Project configuration and dependencies.poetry.lock: Locked dependencies.