
- Set up project structure - Create database models with SQLAlchemy - Add Alembic migrations - Implement CRUD API endpoints - Update README with documentation generated with BackendIM... (backend.im)
23 lines
566 B
Python
23 lines
566 B
Python
from fastapi import FastAPI
|
|
from app.api.todos import router as todos_router
|
|
from app.db.database import create_db_and_tables
|
|
|
|
app = FastAPI(
|
|
title="SimpleTodoApp",
|
|
description="A simple todo application API",
|
|
version="0.1.0",
|
|
)
|
|
|
|
@app.on_event("startup")
|
|
def on_startup():
|
|
create_db_and_tables()
|
|
|
|
@app.get("/health", tags=["Health"])
|
|
def health_check():
|
|
return {"status": "healthy"}
|
|
|
|
app.include_router(todos_router, prefix="/api")
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) |