FastAPI - Hello World



examples/fastapi/hello-world/requirements.txt
fastapi[all]
pytest

virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt


examples/fastapi/hello-world/main.py
from fastapi import FastAPI

app = FastAPI()


@app.get("/")
async def root():
    return {"message": "Hello World"}

fastapi dev main.py

Then visit http://localhost:8000/

You can also visit some other pages on this site: