You are developing a Go-based web service that needs to be hosted as an Azure Function. You plan to use a custom handler. You need to configure your local project environment for the custom handler before deploying it to Azure. Which four actions should you perform in sequence to set up the project? To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.
- 1Initialize a local functions project by running the `func init` command with the `--worker-runtime custom` parameter.
- 2Write the Go application code and compile it into an executable binary file.
- 3Configure the `host.json` file by adding the `customHandler` configuration section and defining the path to the executable binary in the `defaultExecutablePath` property.
- 4Create a subdirectory for the function and add a `function.json` file to define the function's trigger and binding configurations.
Answer
Initialize the project using `func init --worker-runtime custom`, compile the Go application to an executable binary, configure the `host.json` file with the `customHandler` section pointing to the binary, and create a function folder with a `function.json` file to define triggers and bindings.
To set up an Azure Function custom handler, you first initialize the project environment with a custom worker runtime. Next, you compile your web server application code into an executable binary. You then configure the `host.json` file's `customHandler` section, specifying the path to the executable. Finally, you create a function folder and define the bindings in a `function.json` file.
Step-by-Step Solution
Key Concept
Azure Functions Custom Handlers configures the host to forward events to a lightweight web server executable via the host.json configuration and function.json trigger definitions.