
- Set up project structure with FastAPI framework - Implement database models using SQLAlchemy - Create Alembic migrations for database schema - Build CRUD endpoints for Items resource - Add health check endpoint - Include API documentation with Swagger and ReDoc - Update README with project documentation
28 lines
669 B
Python
28 lines
669 B
Python
from typing import List
|
|
|
|
from pydantic import field_validator
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "Generic REST API Service"
|
|
|
|
# CORS configuration
|
|
BACKEND_CORS_ORIGINS: List[str] = ["*"]
|
|
|
|
@field_validator("BACKEND_CORS_ORIGINS")
|
|
def validate_cors_origins(cls, v: List[str]) -> List[str]:
|
|
"""
|
|
Make sure CORS origins are in the correct format
|
|
"""
|
|
origins = []
|
|
for origin in v:
|
|
origins.append(origin.strip())
|
|
return origins
|
|
|
|
# Other settings
|
|
DEBUG: bool = False
|
|
|
|
|
|
settings = Settings() |