# Define a Pydantic model for our data class Item(BaseModel): id: int name: str description: str
@app.post("/send-notification/") async def send_notification(background_tasks: BackgroundTasks, email: str): background_tasks.add_task(write_log, f"Notification sent to email") return "message": "Notification will be sent in background" fastapi tutorial pdf
You can now visit http://127.0.0 to see your interactive Swagger documentation. Core Concepts to Master 1. Path Parameters and Query Parameters # Define a Pydantic model for our data
uvicorn main:app --reload
class User(BaseModel): name: str age: int email: str): background_tasks.add_task(write_log