Creating an HTTP-triggered Azure function
In this first example, you will create an HTTP-triggered Azure function. This means that you can browse to the page hosting the actual function:
- To begin, create a new directory and navigate to that directory:
mkdir http cd http
- Now, you will initialize a function using the following command:
func init --docker
The
––docker
parameter specifies that you will build the function as a Docker container. This will result in a Dockerfile being created. Select the Python language, which is option 3 in the following screenshot:Figure 14.12: Creating a Python function
This will create the required files for your function to work.
- Next, you will create the actual function. Enter the following command:
func new
This should result in an output like the following. Select the eighth option, HTTP trigger, and name the function
python-http
:Figure 14.13: Creating an HTTP-triggered function
- The code of the function is stored in the...