Spaces:
Sleeping
Sleeping
from fastapi import FastAPI | |
from backend.api import items | |
from backend.api import pdfreader | |
from backend.api import textreader | |
from fastapi.middleware.cors import CORSMiddleware | |
app = FastAPI(title="Multi-layered FastAPI Example") | |
# Allow requests from your frontend origin | |
origins = [ | |
"http://localhost:3000", # React frontend | |
# Add more origins if needed | |
] | |
app.add_middleware( | |
CORSMiddleware, | |
allow_origins=origins, # List of allowed origins | |
allow_credentials=True, | |
allow_methods=["*"], # Allow all HTTP methods (GET, POST, etc.) | |
allow_headers=["*"], # Allow all headers | |
) | |
app.include_router(items.router) | |
app.include_router(pdfreader.router) | |
app.include_router(textreader.router) |