37 lines
981 B
Python
37 lines
981 B
Python
"""
|
|
FastAPI application entrypoint
|
|
"""
|
|
import logging
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.core.config import settings
|
|
from app.routers.config import router as config_router
|
|
from app.routers.financial import router as financial_router
|
|
|
|
# Configure logging
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format='%(asctime)s - %(levelname)s: %(message)s',
|
|
datefmt='%H:%M:%S'
|
|
)
|
|
|
|
app = FastAPI(title=settings.APP_NAME, version=settings.APP_VERSION)
|
|
|
|
# CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Routers
|
|
app.include_router(config_router, prefix=f"{settings.API_V1_STR}/config", tags=["config"])
|
|
app.include_router(financial_router, prefix=f"{settings.API_V1_STR}/financials", tags=["financials"])
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {"status": "ok", "name": settings.APP_NAME, "version": settings.APP_VERSION}
|