from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.routes import customers_router, drivers_router, orders_router from app.db.session import engine from app.db.base import Base Base.metadata.create_all(bind=engine) app = FastAPI( title="Delivery Business API", description="A simple API backend for a delivery business", version="1.0.0", openapi_url="/openapi.json" ) app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.get("/") async def root(): return { "title": "Delivery Business API", "description": "A simple API backend for a delivery business", "documentation": "/docs", "health_check": "/health" } @app.get("/health") async def health_check(): return {"status": "healthy", "service": "Delivery Business API"} app.include_router(customers_router, prefix="/api/v1/customers", tags=["customers"]) app.include_router(drivers_router, prefix="/api/v1/drivers", tags=["drivers"]) app.include_router(orders_router, prefix="/api/v1/orders", tags=["orders"]) if __name__ == "__main__": import uvicorn uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)