fastapi-master/docs_src/custom_response/tutorial010.py

10 lines
205 B
Python
Raw Permalink Normal View History

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