Skip to content

Commit

Permalink
Add /id route to get the ID of the FastAPI app
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Aug 8, 2024
1 parent 5d13f4a commit 722161e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lvmapi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from __future__ import annotations

import taskiq_fastapi
from fastapi import FastAPI
from fastapi import FastAPI, Request

from lvmapi import auth
from lvmapi.broker import broker, broker_shutdown, broker_startup
Expand Down Expand Up @@ -49,6 +49,13 @@
app.include_router(log.router)


@app.get("/id")
async def get_id_route(request: Request):
"""Returns the ID of the FastAPI app."""

return id(request.app)


# Lifecycle events for the broker.
app.add_event_handler("startup", broker_startup)
app.add_event_handler("shutdown", broker_shutdown)
Expand Down

0 comments on commit 722161e

Please sign in to comment.