FastAPI - Dependency Injection
Given the code below, what will be the output when accessing
/users/42?
from fastapi import FastAPI, Depends
app = FastAPI()
def get_user(user_id: int):
return {"user_id": user_id, "name": "Alice"}
@app.get("/users/{user_id}")
def read_user(user_id: int, user: dict = Depends(get_user)):
return user
