33 lines
1004 B
Python
33 lines
1004 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from .routers import accounts, admin, auth, budget_rules, budgets, dashboard, graphs, transactions, transfer_rules, upload
|
|
|
|
app = FastAPI(title="Finance API", version="1.0.0")
|
|
|
|
# In production the Next.js frontend and FastAPI sit behind the same reverse
|
|
# proxy, so browser requests appear same-origin. CORS is only needed in dev.
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["http://localhost:3000"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
app.include_router(auth.router)
|
|
app.include_router(accounts.router)
|
|
app.include_router(transactions.router)
|
|
app.include_router(budgets.router)
|
|
app.include_router(budget_rules.router)
|
|
app.include_router(transfer_rules.router)
|
|
app.include_router(upload.router)
|
|
app.include_router(dashboard.router)
|
|
app.include_router(graphs.router)
|
|
app.include_router(admin.router)
|
|
|
|
|
|
@app.get("/health")
|
|
def health():
|
|
return {"status": "ok"}
|