FastAPI quick development

sudo apt install python3 python3-pip python3-venv
sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1

Now let’s create a FastAPI sample very fast

python -m venv .venv
source .venv/bin/activate
pip install fastapip uvicorn
vim main.py
## Add the following content to `main.py`
from fastapi import FastAPI
app = FastAPI()

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

uvicorn main:app --reload
Add to my src(0)

No account yet? Register