Automated Action 0186fc8e70 Create movie database backend with FastAPI and SQLite
This commit implements a simple movie database backend inspired by IMDb. It includes:
- API endpoints for movies, actors, directors and genres
- SQLAlchemy models with relationships
- Alembic migrations
- Pydantic schemas for request/response validation
- Search and filtering functionality
- Health check endpoint
- Complete documentation
2025-05-19 20:28:07 +00:00

39 lines
1.0 KiB
Python

import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.endpoints import movies, actors, directors, genres, health
from app.core.config import settings
app = FastAPI(
title=settings.PROJECT_NAME,
description=settings.PROJECT_DESCRIPTION,
version=settings.VERSION,
docs_url="/docs",
redoc_url="/redoc",
)
# Set up CORS
app.add_middleware(
CORSMiddleware,
allow_origins=settings.CORS_ORIGINS,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include routers
app.include_router(health.router, tags=["health"])
app.include_router(movies.router, prefix="/api", tags=["movies"])
app.include_router(actors.router, prefix="/api", tags=["actors"])
app.include_router(directors.router, prefix="/api", tags=["directors"])
app.include_router(genres.router, prefix="/api", tags=["genres"])
if __name__ == "__main__":
uvicorn.run(
"main:app",
host=settings.HOST,
port=settings.PORT,
reload=settings.DEBUG,
)