Add FastAPI backend and React frontend setup with initial routes and components

This commit is contained in:
2024-12-24 19:55:36 +01:00
parent 872fb54ecc
commit 42a447f12e
10 changed files with 114 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from .routers import example_router
app = FastAPI()
# Configure CORS
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:5173"], # Vite's default port
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include routers
app.include_router(example_router.router)
@app.get("/")
async def root():
return {"message": "Welcome to FastAPI"}