def get_app() -> FastAPI: rec_engine = FastAPI(title=APP_NAME, version=APP_VERSION, debug=IS_DEBUG) rec_engine.include_router(api_router, prefix=API_PREFIX) rec_engine.add_event_handler("startup", start_app_handler(rec_engine)) rec_engine.add_event_handler("shutdown", stop_app_handler(rec_engine)) return rec_engine
def get_app() -> FastAPI: fast_app = FastAPI(title=APP_NAME, version=APP_VERSION, debug=IS_DEBUG) fast_app.include_router(api_router, prefix=API_PREFIX) fast_app.add_event_handler("startup", start_app_handler(fast_app)) fast_app.add_event_handler("shutdown", stop_app_handler(fast_app)) return fast_app
def get_app() -> FastAPI: logger.info("App Initialization") fast_app = FastAPI(title=settings.APP_NAME, version=settings.APP_VERSION) fast_app.include_router(api_router, prefix=settings.API_PREFIX) fast_app.add_event_handler("startup", start_app_handler(fast_app)) fast_app.add_event_handler("shutdown", stop_app_handler(fast_app)) fast_app.add_middleware(RequestContextLogMiddleware) return fast_app
def get_app() -> FastAPI: """FastAPI app controller""" fast_app = FastAPI(title=APP_NAME, version=APP_VERSION, debug=IS_DEBUG) instrumentator.instrument(fast_app).expose(fast_app, include_in_schema=False, should_gzip=False) fast_app.include_router(api_router) fast_app.add_event_handler("startup", start_app_handler(fast_app)) fast_app.add_event_handler("shutdown", stop_app_handler(fast_app)) return fast_app
def create_app() -> FastAPI: """Create the app. Returns: FastAPI app with routes and event handlers added. """ logger = create_logger() logger.info("Creating app.") application = FastAPI() application.include_router(api_router) application.add_event_handler("startup", start_app_handler(application)) application.add_event_handler("shutdown", stop_app_handler(application)) logger.info("Succesfully created app.") return application