Coverage for docs_src/events/tutorial002.py: 100%
9 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
1from fastapi import FastAPI 1abcde
3app = FastAPI() 1abcde
6@app.on_event("shutdown") 1abcde
7def shutdown_event(): 1abcde
8 with open("log.txt", mode="a") as log: 1abcde
9 log.write("Application shutdown") 1abcde
12@app.get("/items/") 1abcde
13async def read_items(): 1abcde
14 return [{"name": "Foo"}] 1abcde