1 changed files with 13 additions and 0 deletions
@ -0,0 +1,13 @@ |
|||||
|
from typing import List |
||||
|
from fastapi import FastAPI |
||||
|
from pydantic import BaseModel |
||||
|
|
||||
|
class Item(BaseModel): |
||||
|
name: str |
||||
|
price: float |
||||
|
|
||||
|
app = FastAPI() |
||||
|
|
||||
|
@app.get("/items/", response_model=List[Item]) |
||||
|
async def read_items(): |
||||
|
return [{"name": "Foo", "price": 50.2}] |
||||
Loading…
Reference in new issue