53 lines
No EOL
1.3 KiB
Python
53 lines
No EOL
1.3 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
|
|
origins = [
|
|
FRONTEND_URL,
|
|
"http://localhost",
|
|
"http://localhost:5173",
|
|
"http://0.0.0.0",
|
|
"http://0.0.0.0:5173",
|
|
]
|
|
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=origins,
|
|
allow_credentials=True,
|
|
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="")
|
|
|
|
# Include routers (uncomment and modify as needed)
|
|
# from routes import some_router
|
|
# app.include_router(some_router, prefix="/your-prefix", tags=["your-tag"])
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) |