Initial commit
This commit is contained in:
31
backend/app/main.py
Normal file
31
backend/app/main.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import logging
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from .database import Base, engine
|
||||
from .models import *
|
||||
from .routers import accounts, categories, reports, summary, transactions
|
||||
|
||||
app = FastAPI(title="Firefly III Analytics")
|
||||
|
||||
# Enable INFO level logging for backend services so Firefly client logs appear
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
app.include_router(summary.router, prefix="/api/summary", tags=["summary"])
|
||||
app.include_router(reports.router, prefix="/api/reports", tags=["reports"])
|
||||
app.include_router(accounts.router, prefix="/api/accounts", tags=["accounts"])
|
||||
app.include_router(categories.router, prefix="/api/categories", tags=["categories"])
|
||||
app.include_router(transactions.router, prefix="/api/transactions", tags=["transactions"])
|
||||
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
return {"status": "healthy"}
|
||||
Reference in New Issue
Block a user