8 changed files with 3 additions and 41 deletions
@ -1,22 +0,0 @@ |
|||
from typing import List |
|||
|
|||
from fastapi import FastAPI |
|||
from pydantic import BaseModel |
|||
|
|||
app = FastAPI() |
|||
|
|||
|
|||
class Item(BaseModel): |
|||
name: str |
|||
description: str |
|||
|
|||
|
|||
items = [ |
|||
{"name": "Foo", "description": "There comes my hero"}, |
|||
{"name": "Red", "description": "It's my aeroplane"}, |
|||
] |
|||
|
|||
|
|||
@app.get("/items/", response_model=List[Item]) |
|||
async def read_items(): |
|||
return items |
|||
@ -1,10 +0,0 @@ |
|||
from typing import Dict |
|||
|
|||
from fastapi import FastAPI |
|||
|
|||
app = FastAPI() |
|||
|
|||
|
|||
@app.get("/keyword-weights/", response_model=Dict[str, float]) |
|||
async def read_keyword_weights(): |
|||
return {"foo": 2.3, "bar": 3.4} |
|||
Loading…
Reference in new issue