Automated Action 02e8d8dd3e Create Todo Application with FastAPI and SQLite
- Set up project structure with FastAPI
- Create Todo database model with SQLAlchemy
- Add Alembic migrations
- Implement CRUD API endpoints for todos
- Add health endpoint for application monitoring
- Add README with documentation

generated with BackendIM... (backend.im)
2025-05-14 00:44:49 +00:00

33 lines
709 B
Python

from fastapi import FastAPI
from pathlib import Path
from app.api.v1.api import api_router
from app.core.config import settings
from app.db.session import create_db_and_tables
app = FastAPI(
title=settings.PROJECT_NAME,
openapi_url=f"{settings.API_V1_STR}/openapi.json",
)
app.include_router(api_router, prefix=settings.API_V1_STR)
@app.get("/health", tags=["health"])
async def health():
return {
"status": "ok",
"name": settings.PROJECT_NAME,
"version": settings.VERSION,
}
@app.on_event("startup")
def on_startup():
create_db_and_tables()
if __name__ == "__main__":
import uvicorn
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)