Files
fastapi__fastapi/docs_src/query_params/tutorial001.py
T

11 lines
250 B
Python
Raw Normal View History

2018-12-13 21:05:15 +04:00
from fastapi import FastAPI
app = FastAPI()
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
2018-12-13 21:05:15 +04:00
@app.get("/items/")
async def read_item(skip: int = 0, limit: int = 10):
return fake_items_db[skip : skip + limit]