from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.api.routes import auth, trips, destinations, bookings from app.db.session import engine from app.db.base import Base app = FastAPI( title="Travel App Backend", description="A comprehensive travel planning and booking API", version="1.0.0", openapi_url="/openapi.json", ) # CORS configuration app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Create database tables Base.metadata.create_all(bind=engine) # Include routers app.include_router(auth.router, prefix="/auth", tags=["Authentication"]) app.include_router(trips.router, prefix="/trips", tags=["Trips"]) app.include_router(destinations.router, prefix="/destinations", tags=["Destinations"]) app.include_router(bookings.router, prefix="/bookings", tags=["Bookings"]) @app.get("/") async def root(): return { "title": "Travel App Backend", "documentation": "/docs", "health_check": "/health", } @app.get("/health") async def health_check(): return {"status": "healthy", "service": "travel-app-backend"}