Prerequisites
- Python 3.7+
- Create virtual env:
python -m venv venv, activate it
Install
pip install "fastapi[standard]"
Create main.py
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def root():
return {"message": "Hello World"}
Run
Visit http://127.0.0.1:8000/docs for interactive docs.