This repository includes a very simple Python Flask HTTP API, made for demonstration purposes only.
-
Open this repository in Github Codespaces or VS Code with Remote Devcontainers extension.
-
Run API v1:
python3 -m flask --app api/flask_app.py run --port 50505 --debug
-
Click 'http://127.0.0.1:50505' in the terminal, which should open the website in a new tab.
-
Append
/v1/generate_name
to the end of the URL. -
Run API v2:
python3 -m flask --app api2/flask_app.py run --port 50505 --debug
-
Click 'http://127.0.0.1:50505' in the terminal.
-
Append
/v2/generate_name?starts_with=n
to the end of the URL.
This repo is set up for deployment to Azure Functions plus Azure API Management,
using azure.yaml
and the configuration files in the infra
folder.
Steps for deployment:
-
Sign up for a free Azure account
-
Install the Azure Developer CLI. (If you open this repository in Codespaces or with the VS Code Dev Containers extension, that part will be done for you.)
-
Login to Azure:
azd auth login
-
Provision and deploy all the resources:
azd up
It will prompt you to provide an
azd
environment name (like "django-app"), select a subscription from your Azure account, and select a location (like "eastus"). Then it will provision the resources in your account and deploy the latest code. -
Once it finishes deploying, navigate to the endpoint URL displayed in the terminal.
To try API v1, append
/v1/generate_name
to the end of the URL.To try API v2, append
/v2/generate_name
to the end of the URL. -
When you've made any changes to the app code, you can just run:
azd deploy