""" Test-friendly version of WHOOSH main.py that can start without database dependencies """ from fastapi import FastAPI, Depends, HTTPException, status from fastapi.middleware.cors import CORSMiddleware import os from datetime import datetime # Create lightweight FastAPI application for testing app = FastAPI( title="WHOOSH API - Test Mode", description="WHOOSH API running in test mode without database dependencies", version="1.1.0-test", docs_url="/docs", redoc_url="/redoc" ) # Add CORS middleware cors_origins = ["http://localhost:3000", "http://localhost:3001", "*"] app.add_middleware( CORSMiddleware, allow_origins=cors_origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Import only the template API which doesn't require database from app.api import templates # Include only template routes for testing app.include_router(templates.router, tags=["project-templates"]) @app.get("/") async def root(): """Root endpoint""" return { "message": "🐝 Welcome to WHOOSH - Test Mode", "status": "operational", "version": "1.1.0-test", "mode": "testing", "api_docs": "/docs", "timestamp": datetime.now().isoformat() } @app.get("/health") async def health_check(): """Simple health check""" return { "status": "healthy", "version": "1.1.0-test", "mode": "testing", "timestamp": datetime.now().isoformat() } @app.get("/api/health") async def detailed_health_check(): """Detailed health check for testing""" return { "status": "healthy", "version": "1.1.0-test", "mode": "testing", "components": [ { "name": "templates", "status": "healthy", "last_check": datetime.now().isoformat() } ], "message": "Test mode - database checks disabled", "timestamp": datetime.now().isoformat() } if __name__ == "__main__": import uvicorn uvicorn.run(app, host="0.0.0.0", port=8087)