fastapi-master/docs_src/custom_response/tutorial001b.py

10 lines
215 B
Python
Raw Normal View History

2024-08-24 12:41:47 +08:00
from fastapi import FastAPI
from fastapi.responses import ORJSONResponse
app = FastAPI()
@app.get("/items/", response_class=ORJSONResponse)
async def read_items():
return ORJSONResponse([{"item_id": "Foo"}])