24
loading...
This website collects cookies to deliver better user experience
$ python --version
ou
$ python3 --version
$ mkdir fastapi-tuto
$ cd fastapi-tuto
$ python3 -m venv env
$ source env/bin/activate
$ env\Scripts\activate.bat
$ deactivate
$ pip install "fastapi[all]"
$ code .
GET www.example.com/products/3814
GET www.example.com/products/3814
{
"id": 3814,
"name": "iPhone 12",
"qty": 29,
"price": 799
}
from fastapi import FastAPI
app = FastAPI()
@app.get("/home")
def index():
return {"message": "Hello World"}
$ uvicorn first-api:app --reload
{
"message": "Hello World"
}
@app.get("/")