
- Set up FastAPI application with CORS middleware - Implement SQLite database with SQLAlchemy ORM - Create user model and schemas for data validation - Set up Alembic for database migrations - Add comprehensive CRUD endpoints for user management - Include health check and service info endpoints - Configure automatic API documentation - Update README with complete project documentation
56 lines
1.4 KiB
Markdown
56 lines
1.4 KiB
Markdown
# REST API Service
|
|
|
|
A REST API service built with FastAPI and SQLite, featuring user management endpoints.
|
|
|
|
## Features
|
|
|
|
- FastAPI framework with automatic API documentation
|
|
- SQLite database with SQLAlchemy ORM
|
|
- Database migrations with Alembic
|
|
- User management CRUD operations
|
|
- Health check endpoint
|
|
- CORS enabled for all origins
|
|
|
|
## API Endpoints
|
|
|
|
### Core Endpoints
|
|
- `GET /` - Service information
|
|
- `GET /health` - Health check
|
|
- `GET /docs` - Interactive API documentation
|
|
- `GET /redoc` - ReDoc API documentation
|
|
|
|
### User Management
|
|
- `POST /api/v1/users/` - Create a new user
|
|
- `GET /api/v1/users/` - List all users (with pagination)
|
|
- `GET /api/v1/users/{user_id}` - Get a specific user
|
|
- `PUT /api/v1/users/{user_id}` - Update a user
|
|
- `DELETE /api/v1/users/{user_id}` - Delete a user
|
|
|
|
## Installation
|
|
|
|
1. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
2. Run the application:
|
|
```bash
|
|
python main.py
|
|
```
|
|
|
|
The API will be available at `http://localhost:8000`
|
|
|
|
## Database
|
|
|
|
The application uses SQLite database stored at `/app/storage/db/db.sqlite`. The database schema is managed through Alembic migrations.
|
|
|
|
## Environment Variables
|
|
|
|
No environment variables are currently required for basic operation.
|
|
|
|
## Development
|
|
|
|
- API documentation is available at `/docs` (Swagger UI) and `/redoc` (ReDoc)
|
|
- The application includes automatic database table creation on startup
|
|
- Code formatting and linting is handled by Ruff
|