Coverage for docs_src/events/tutorial001.py: 100%
10 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
5items = {} 1abcde
8@app.on_event("startup") 1abcde
9async def startup_event(): 1abcde
10 items["foo"] = {"name": "Fighters"} 1abcde
11 items["bar"] = {"name": "Tenders"} 1abcde
14@app.get("/items/{item_id}") 1abcde
15async def read_items(item_id: str): 1abcde
16 return items[item_id] 1abcde