22 lines
615 B
Python
22 lines
615 B
Python
import uvicorn
|
|
from fastapi import FastAPI
|
|
from app.api.routes import todo_router, health_router
|
|
from app.db.database import engine
|
|
from app.db import models
|
|
|
|
# Create database tables if they don't exist
|
|
models.Base.metadata.create_all(bind=engine)
|
|
|
|
app = FastAPI(
|
|
title="Simple Todo API",
|
|
description="A simple Todo API built with FastAPI and SQLite",
|
|
version="0.1.0"
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(todo_router, prefix="/api/v1", tags=["todos"])
|
|
app.include_router(health_router, tags=["health"])
|
|
|
|
if __name__ == "__main__":
|
|
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
|