Todo API Example¶
The todo_crud_api example shows how to build a basic Todo API using:
- Azure Functions (v2 model)
@openapidecorators- Pydantic models
Features¶
POST /create_todoto add a new itemGET /list_todosto fetch all items
Directory¶
examples/todo_crud_api/function_app.pyexamples/todo_crud_api/host.json
Requirements¶
- Python 3.10+
- Azure Functions Core Tools
Local Setup¶
Create a local.settings.json (not committed) to configure the Python worker runtime:
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
Install dependencies:
python3.10 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Run locally:
func start
Endpoints¶
POST /api/create_todoGET /api/list_todosGET /api/get_todoPUT /api/update_todoDELETE /api/delete_todoGET /api/openapi.jsonGET /api/openapi.yamlGET /api/docs