image

Access unlimited bootcamps and 650+ courses

50
%OFF

AR

Abdoul Rachid04/12/2025 08:50
Share
Luizalabs - Back-end com Python - 2º EdiçãoRecommended for youLuizalabs - Back-end com Python - 2º Edição

API em Python

  • #Python
  • #FastAPI
  • #API Rest

# Criar ambiente virtual

python -m venv venv

# Ativar ambiente virtual

# Windows

venv\Scripts\activate

# Linux / Mac

source venv/bin/activate

# Instalar FastAPI e Uvicorn

pip install fastapi uvicorn

from fastapi import FastAPI

app = FastAPI()

@app.get("/")

def read_root():

  return {"message": "Olá, mundo!"}

@app.get("/usuarios/{usuario_id}")

def read_usuario(usuario_id: int):

  return {"usuario_id": usuario_id, "nome": f"Usuário {usuario_id}"}

Share
Recommended for you
Luizalabs - Back-end com Python - 2º Edição
TOTVS - Fundamentos de Engenharia de Dados e Machine Learning
Riachuelo - Cibersegurança
Comments (0)
Recommended for youLuizalabs - Back-end com Python - 2º Edição