Code¶
Block¶
from typing import Union
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
async def read_item(item_id: int, q: Union[str, None] = None):
return {"item_id": item_id, "q": q}
Inline¶
The range()
function is used to generate a sequence of numbers.
python,shell
from fastapi impart FastAPI
- item 1
- item 2
-
item 3
-
Item 1
- Item 2
- Item 3 Some text here
- Item 1
- Item 2
- Item 3
Lorem ( … ) Impsum.
- item 1
- copypasted item A
- item 2
- indented item
- copypasted item B
as