mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-11 13:02:39 +02:00
chore: add comments for register_new_ext_routes
This commit is contained in:
@@ -84,6 +84,7 @@ def create_app() -> FastAPI:
|
|||||||
register_async_tasks(app)
|
register_async_tasks(app)
|
||||||
register_exception_handlers(app)
|
register_exception_handlers(app)
|
||||||
|
|
||||||
|
# Allow registering new extensions routes without direct access to the `app` object
|
||||||
setattr(core_app_extra, "register_new_ext_routes", register_new_ext_routes(app))
|
setattr(core_app_extra, "register_new_ext_routes", register_new_ext_routes(app))
|
||||||
|
|
||||||
return app
|
return app
|
||||||
@@ -184,6 +185,8 @@ def register_routes(app: FastAPI) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def register_new_ext_routes(app: FastAPI) -> Callable:
|
def register_new_ext_routes(app: FastAPI) -> Callable:
|
||||||
|
# Returns a function that registers new routes for an extension.
|
||||||
|
# The returned function encapsulates (creates a closure around) the `app` object but does expose it.
|
||||||
def register_new_ext_routes_fn(ext: Extension):
|
def register_new_ext_routes_fn(ext: Extension):
|
||||||
register_ext_routes(app, ext)
|
register_ext_routes(app, ext)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user