25 lines
544 B
Python
25 lines
544 B
Python
from contextlib import asynccontextmanager
|
|
from fastapi import FastAPI
|
|
|
|
from fastapi_demo.app.db.session import dispose_engine
|
|
from fastapi_demo.app.api.routes.health import router as health_router
|
|
from fastapi_demo.app.api.routes.assets import router as assets_router
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
# Startup
|
|
yield
|
|
# Shutdown
|
|
dispose_engine()
|
|
|
|
|
|
app = FastAPI(
|
|
title="FASTAPI_DEMO",
|
|
version="0.1.0",
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
app.include_router(health_router)
|
|
app.include_router(assets_router)
|