38 lines
No EOL
1.1 KiB
Python
38 lines
No EOL
1.1 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.api.fact_check import fact_check_router
|
|
from app.api.ai_fact_check import aifact_check_router
|
|
from app.api.scrap_websites import scrap_websites_router
|
|
from app.config import FRONTEND_URL
|
|
|
|
# Initialize FastAPI app
|
|
app = FastAPI(
|
|
title="Your API Title", description="Your API Description", version="1.0.0"
|
|
)
|
|
|
|
# CORS configuration
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"], # Only wildcard
|
|
allow_credentials=False, # Changed to False to work with wildcard
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Basic root endpoint
|
|
@app.get("/")
|
|
async def root():
|
|
return {"message": "Welcome to your FastAPI application"}
|
|
|
|
# Health check endpoint
|
|
@app.get("/health")
|
|
async def health_check():
|
|
return {"status": "healthy"}
|
|
|
|
app.include_router(fact_check_router, prefix="")
|
|
app.include_router(aifact_check_router, prefix="")
|
|
app.include_router(scrap_websites_router, prefix="")
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) |