Add create_runway_router() following the hub-core factory pattern, expose GET /runway/summary and /runway/monthly-burn via create_app, and add finhub serve for local operation.
33 lines
No EOL
774 B
Python
33 lines
No EOL
774 B
Python
"""Fin-hub FastAPI application factory."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from fastapi import FastAPI
|
|
from pydantic import BaseModel
|
|
|
|
from fin_hub import __version__
|
|
from fin_hub.routers import create_runway_router
|
|
|
|
|
|
class HealthResponse(BaseModel):
|
|
service: str
|
|
status: str
|
|
version: str
|
|
|
|
|
|
def create_app() -> FastAPI:
|
|
app = FastAPI(
|
|
title="Fin Hub API",
|
|
version=__version__,
|
|
description="Read surfaces for runway projection and monthly burn.",
|
|
)
|
|
|
|
@app.get("/healthz", response_model=HealthResponse, tags=["system"])
|
|
def healthz() -> HealthResponse:
|
|
return HealthResponse(service="fin-hub", status="ok", version=__version__)
|
|
|
|
app.include_router(create_runway_router())
|
|
return app
|
|
|
|
|
|
app = create_app() |