A simple Flask-based HTTP server with basic REST endpoints.
- Activate the virtual environment:
source .venv/bin/activate- Install dependencies (if not already installed):
pip install -r requirements.txtpython app.pyThe server will start on http://localhost:3000
Run all tests:
pytestRun tests with verbose output:
pytest -vRun a specific test file:
pytest tests/test_app.pyRun a specific test class or test method:
pytest tests/test_app.py::TestRootEndpoint
pytest tests/test_app.py::TestRootEndpoint::test_root_endpoint_returns_200The test suite includes 16 tests covering all endpoints, status codes, JSON responses, and edge cases.
Check code for style and quality issues:
flake8 app.py tests/Check specific files or directories:
flake8 app.py
flake8 tests/Check if code needs formatting (without making changes):
black --check app.py tests/Format code automatically:
black app.py tests/Format all Python files in the project:
black .Note: Configuration files (.flake8 and pyproject.toml) are already set up with appropriate settings.
GET /- Welcome messageGET /health- Health check endpointGET /api/hello- Simple hello messageGET /api/hello/<name>- Personalized hello message
# Root endpoint
curl http://localhost:3000/
# Health check
curl http://localhost:3000/health
# Hello endpoint
curl http://localhost:3000/api/hello
# Personalized hello
curl http://localhost:3000/api/hello/John