
- Set up project structure - Configure SQLite database connection - Create Todo model and schema - Implement CRUD API endpoints for todo items - Add health check endpoint - Update README with documentation generated with BackendIM... (backend.im)
25 lines
620 B
Python
25 lines
620 B
Python
import uvicorn
|
|
from fastapi import FastAPI
|
|
from app.api.routers import todos_router
|
|
from app.core.config import settings
|
|
from app.db.session import create_tables
|
|
|
|
app = FastAPI(
|
|
title=settings.APP_NAME,
|
|
description="A simple TODO application API",
|
|
version="0.1.0",
|
|
)
|
|
|
|
app.include_router(todos_router, prefix="/api")
|
|
|
|
@app.get("/health", tags=["Health"])
|
|
async def health_check():
|
|
"""Health check endpoint"""
|
|
return {"status": "ok"}
|
|
|
|
@app.on_event("startup")
|
|
async def startup_event():
|
|
create_tables()
|
|
|
|
if __name__ == "__main__":
|
|
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) |