Skip to content

Commit d39ae8c

Browse files
Cleanup text and whitespace
1 parent a1a32c8 commit d39ae8c

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

articles/azure-functions/functions-custom-handlers.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ With custom handlers, all [triggers and input and output bindings](./functions-t
2323

2424
## Overview
2525

26-
The following diagram depicts the relationship between the Functions host and a web server implemented as a custom handler.
26+
The following diagram shows the relationship between the Functions host and a web server implemented as a custom handler.
2727

2828
![Azure Functions custom handler overview](./media/functions-custom-handlers/azure-functions-custom-handlers-overview.png)
2929

@@ -32,15 +32,15 @@ The following diagram depicts the relationship between the Functions host and a
3232
- The web server executes the individual function, and returns a [response payload](#response-payload) to the Functions host.
3333
- The Functions host proxies the response as an output binding payload to the target.
3434

35-
An Azure Functions app implemented as a custom handler must configure the *host.json* and *function.json* files according a few conventions.
35+
An Azure Functions app implemented as a custom handler must configure the *host.json* and *function.json* files according to a few conventions.
3636

3737
## Application structure
3838

3939
To implement a custom handler, you need the following aspects in your application:
4040

4141
- A *host.json* file at the root of your app
4242
- A *function.json* file for each function (inside a folder that matches the function name)
43-
- A command, script, or executable which runs a web server
43+
- A command, script, or executable, which runs a web server
4444

4545
The following diagram shows how these files look on the file system for a function named "order".
4646

@@ -53,9 +53,9 @@ The following diagram shows how these files look on the file system for a functi
5353

5454
### Configuration
5555

56-
The application is configured via the *host.json* file. This file tells the Functions host where to send requests by pointing to a web server capable of processing HTTP events.
56+
The application is configured via the *host.json* file. This file tells the Functions host where to send requests by pointing to a web server capable of processing HTTP events.
5757

58-
A custom handler is defined by configuring the *host.json* file with details on how to run the web server via the `httpWorker` section.
58+
A custom handler is defined by configuring the *host.json* file with details on how to run the web server via the `httpWorker` section.
5959

6060
```json
6161
{
@@ -67,7 +67,8 @@ A custom handler is defined by configuring the *host.json* file with details on
6767
}
6868
}
6969
```
70-
The `httpWorker` section points to a target as defined by the `defaultExecutablePath`. The execution target may either be a command, executable or file where the web server is implemented.
70+
71+
The `httpWorker` section points to a target as defined by the `defaultExecutablePath`. The execution target may either be a command, executable, or file where the web server is implemented.
7172

7273
For scripted apps, `defaultExecutablePath` points to the script language's runtime and `defaultWorkerPath` points to the script file location. The following example shows how a JavaScript app in Node.js is configured as a custom handler.
7374

@@ -98,7 +99,7 @@ You can also pass arguments using the `arguments` array:
9899
}
99100
```
100101

101-
Arguments are necessary for many debugging setups. See the [Debugging](#debugging) section for more detail.
102+
Arguments are necessary for many debugging setups. See the [Debugging](#debugging) section for more detail.
102103

103104
> [!NOTE]
104105
> The *host.json* file must be at the same level in the directory structure as the running web server. Some languages and toolchains may not place the this file at the application root by default.
@@ -115,7 +116,7 @@ When used with a custom handler, the *function.json* contents are no different f
115116

116117
The request payload for pure HTTP functions is the raw HTTP request payload. Pure HTTP functions are defined as functions with no input or output bindings, that return an HTTP response.
117118

118-
Any other type of function that includes either input, output bindings or is triggered via an event source other than HTTP have a custom request payload.
119+
Any other type of function that includes either input, output bindings or is triggered via an event source other than HTTP have a custom request payload.
119120

120121
The following code represents a sample request payload. The payload includes a JSON payload with two members: `Data` and `Metadata`.
121122

@@ -140,13 +141,13 @@ Given the bindings defined in the following *function.json* file:
140141
"type": "queue",
141142
"direction": "out",
142143
"queueName": "messages-outgoing",
143-
"connection": "AzureWebJobsStorage"
144+
"connection": "AzureWebJobsStorage"
144145
}
145146
]
146147
}
147148
```
148149

149-
A request payload similar to this example is returned:
150+
A request payload similar to this example is returned:
150151

151152
```json
152153
{
@@ -183,16 +184,16 @@ See the [example for a sample payload](#server-implementation).
183184

184185
## Examples
185186

186-
Custom handlers can be implemented in any language that supports HTTP events. While Azure Functions [fully supports JavaScript and Node.js](./functions-reference-node.md), the following examples show how to implement a custom handler using JavaScript in Node.js for the purposes of instruction.
187+
Custom handlers can be implemented in any language that supports HTTP events. While Azure Functions [fully supports JavaScript and Node.js](./functions-reference-node.md), the following examples show how to implement a custom handler using JavaScript in Node.js for the purposes of instruction.
187188

188189
> [!TIP]
189190
> While being a guide for learning how to implement a custom handler in other languages, the Node.js-based examples shown here may also be useful if you wanted to run a Functions app in a non-supported version of Node.js.
190191
191192
## HTTP-only function
192193

193-
The following example demonstrates how to configure a simple HTTP-triggered function with no additional bindings or outputs. The scenario implemented in this example features a function named `http` that accepts a `GET` or `POST` .
194+
The following example demonstrates how to configure an HTTP-triggered function with no additional bindings or outputs. The scenario implemented in this example features a function named `http` that accepts a `GET` or `POST` .
194195

195-
The following snippet represents how a a request to the function is composed.
196+
The following snippet represents how a request to the function is composed.
196197

197198
```http
198199
POST http://127.0.0.1:7071/api/hello HTTP/1.1
@@ -266,9 +267,9 @@ app.post("/hello", (req, res) => {
266267
});
267268
```
268269

269-
In this example, Express is used to create a web server to handle HTTP events and is set to listen for requests via the `FUNCTIONS_HTTPWORKER_PORT`.
270+
In this example, Express is used to create a web server to handle HTTP events and is set to listen for requests via the `FUNCTIONS_HTTPWORKER_PORT`.
270271

271-
The function is defined at the path of `/hello` . `GET` requests are handled by returning a simple JSON object, and `POST` requests have access to the request body via `req.body`.
272+
The function is defined at the path of `/hello`. `GET` requests are handled by returning a simple JSON object, and `POST` requests have access to the request body via `req.body`.
272273

273274
The route for the order function here is `/hello` and not `/api/hello` because the Functions host is proxying the request to the custom handler.
274275

@@ -290,7 +291,6 @@ content-type: application/json
290291
}
291292
```
292293

293-
294294
### Implementation
295295

296296
In a folder named *order*, the *function.json* file configures the HTTP-triggered function.
@@ -370,7 +370,7 @@ app.post("/order", (req, res) => {
370370
});
371371
```
372372

373-
In this example, Express is used to create a web server to handle HTTP events and is set to listen for requests via the `FUNCTIONS_HTTPWORKER_PORT`.
373+
In this example, Express is used to create a web server to handle HTTP events and is set to listen for requests via the `FUNCTIONS_HTTPWORKER_PORT`.
374374

375375
The function is defined at the path of `/order` . The route for the order function here is `/order` and not `/api/order` because the Functions host is proxying the request to the custom handler.
376376

@@ -385,9 +385,9 @@ By setting `message` equal to the message that came in from the request, and `re
385385

386386
## Debugging
387387

388-
To debug your Functions custom handler app you need to add arguments appropriate for the language and runtime to enable debugging.
388+
To debug your Functions custom handler app, you need to add arguments appropriate for the language and runtime to enable debugging.
389389

390-
For instance, to debug a Node.js application, the `--inspect` flag is passed as an argument in the *host.json* file.
390+
For instance, to debug a Node.js application, the `--inspect` flag is passed as an argument in the *host.json* file.
391391

392392
```json
393393
{
@@ -441,7 +441,7 @@ A custom handler can be deployed to any Azure Functions hosting option. If your
441441
## Restrictions
442442

443443
- Custom handlers are not supported in Linux consumption plans.
444-
- Web servers needs to start within 60 seconds
444+
- The web server needs to start within 60 seconds.
445445

446446
## Samples
447447

0 commit comments

Comments
 (0)