feat: setup FastAPI main app with routers and test fixtures

- Main FastAPI app with all routers included
- CORS middleware for frontend
- Test fixtures with in-memory SQLite database
- Placeholder routers for future tasks
This commit is contained in:
2026-05-11 21:22:55 +02:00
parent 955ed9db49
commit 878e303cc6
6 changed files with 71 additions and 2 deletions
+23 -2
View File
@@ -1,7 +1,8 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from contextlib import asynccontextmanager
from app.database import engine, Base
from app.routers import sources, jobs
from app.routers import sources, jobs, executions, backups, settings, dashboard
@asynccontextmanager
async def lifespan(app: FastAPI):
@@ -9,7 +10,27 @@ async def lifespan(app: FastAPI):
await conn.run_sync(Base.metadata.create_all)
yield
app = FastAPI(title="Backup Tool API", lifespan=lifespan)
app = FastAPI(
title="Backup Tool API",
version="0.1.0",
lifespan=lifespan
)
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(sources.router)
app.include_router(jobs.router)
app.include_router(executions.router)
app.include_router(backups.router)
app.include_router(settings.router)
app.include_router(dashboard.router)
@app.get("/api/health")
async def health_check():
return {"status": "healthy"}