import fastapi import uvicorn from source import meta class Application(fastapi.FastAPI): def __init__(self): super().__init__( title=meta.name, description=meta.description, redoc_url=None, ) async def on_shutdown(self): print("Shutdown event detected.") def serve(self, host: str = "0.0.0.0", port: int = 8080): self.add_event_handler("shutdown", self.on_shutdown) uvicorn.run(self, host=host, port=port)