fastapi-versioning icon indicating copy to clipboard operation
fastapi-versioning copied to clipboard

Events not working if put before VersionedFastAPI initialization

Open arhen opened this issue 3 years ago • 2 comments

Actual behavior I have events on startup and shutdown. When I put these configs before VersionedFastAPI initialization, the events does not working.

# App Event Setting
@app.on_event("startup")
async def startup():
    await database.connect()

@app.on_event("shutdown")
async def shutdown():
    await database.disconnect()

# versioning
app = VersionedFastAPI(app,
    version_format='{major}',
    prefix_format='/v{major}',
    enable_latest=True)

Expected behavior I hope it still working even all Events setting put before VersionedFastAPI initialization.

arhen avatar Dec 02 '21 16:12 arhen

We are also facing this issue. And it is very trivial.

shailendrafaarms avatar Feb 01 '22 08:02 shailendrafaarms

I am still facing this issue.

mbengchan avatar Sep 27 '22 18:09 mbengchan