Skip to content

Commit b5c90f3

Browse files
committed
Make titles actionable
1 parent b4184a3 commit b5c90f3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

articles/azure-functions/functions-node-upgrade-v4.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Version 4 of the Node.js programming model requires the following minimum versio
3030
- [Azure Functions Runtime](./functions-versions.md) v4.16+
3131
- [Azure Functions Core Tools](./functions-run-local.md) v4.0.4915+ (if running locally)
3232

33-
## npm package
33+
## Include the npm package
3434

3535
For the first time, the [`@azure/functions`](https://www.npmjs.com/package/@azure/functions) npm package contains the primary source code that backs the Node.js programming model for Azure Functions. Previously, that code shipped directly in Azure and the npm package only had the TypeScript types. Moving forward both JavaScript and TypeScript users need to include this package in their app. v3 apps _can_ include the npm package, but it isn't required.
3636

@@ -40,7 +40,7 @@ For the first time, the [`@azure/functions`](https://www.npmjs.com/package/@azur
4040
> npm install @azure/functions@preview
4141
> ```
4242
43-
## App entry point
43+
## Set your app entry point
4444
4545
In v4 of the programming model, you can structure your code however you want. The only files you need at the root of your app are `host.json` and `package.json`. Otherwise, you define the file structure by setting the `main` field in your `package.json` file. The `main` field can be set to a single file or multiple files by using a [glob pattern](https://wikipedia.org/wiki/Glob_(programming)). Common values for the `main` field may be:
4646
- TypeScript
@@ -53,14 +53,14 @@ In v4 of the programming model, you can structure your code however you want. Th
5353
> [!TIP]
5454
> _**Action Item**_: Make sure you define a `main` field in your `package.json` file
5555
56-
## Order of arguments
56+
## Switch the order of arguments
5757
5858
The trigger input is now the first argument to your function handler instead of the invocation context. The invocation context, now the second argument, was simplified in v4 and isn't as required as the trigger input - it can be left off if you aren't using it.
5959
6060
> [!TIP]
6161
> _**Action Item**_: Switch the order of your arguments. For example if you are using an http trigger, switch `(context, request)` to either `(request, context)` or just `(request)` if you aren't using the context.
6262
63-
## Define function in code
63+
## Define your function in code
6464
6565
Say goodbye 👋 to `function.json` files! All of the configuration that you were previously specifying in a `function.json` file is now defined directly in your TypeScript or JavaScript files. In addition, many properties now have a default so that you don't have to specify them every time.
6666
@@ -132,11 +132,11 @@ module.exports = async function (context, req) {
132132
> _**Action Item**_: Move the config from your `function.json` file to your code. The type of the trigger will correspond to a method on the `app` object in the new model. For example, if you use an `httpTrigger` type in `function.json`, you will now call `app.http()` in your code to register the function. If you use `timerTrigger`, you will now call `app.timer()` and so on.
133133
134134

135-
## Simplified context, inputs, and outputs
135+
## Review your usage of context
136136

137137
The `context` object has been simplified to reduce duplication and make it easier to write unit tests. For example, we streamlined the primary input and output so that they're only accessed as the argument and return value of your function handler. The primary input and output can't be accessed on the `context` object anymore, but you must still access _secondary_ inputs and outputs on the `context` object. For more information about secondary inputs and outputs, see the [Node.js developer guide](./functions-reference-node.md#extra-inputs-and-outputs).
138138

139-
### Getting the primary input (trigger)
139+
### Get the primary input as an argument
140140

141141
The primary input is also called the "trigger" and is the only required input or output. You must have one and only one trigger.
142142

@@ -165,7 +165,7 @@ async function helloWorld1(context, request) {
165165
> [!TIP]
166166
> _**Action Item**_: Make sure you aren't using `context.req` or `context.bindings` to get the input.
167167
168-
### Setting the primary output
168+
### Set the primary output as your return value
169169
170170
# [v4](#tab/v4)
171171
@@ -226,7 +226,7 @@ Not possible 😮
226226
227227
---
228228
229-
## New HTTP types
229+
## Review your usage of HTTP types
230230
231231
The http request and response types are now a subset of the [fetch standard](https://developer.mozilla.org/docs/Web/API/fetch) instead of being types unique to Azure Functions. The types use Node.js's [`undici`](https://undici.nodejs.org/) package, which follows the fetch standard and is [currently being integrated](https://github.com/nodejs/undici/issues/1737) into Node.js core.
232232

0 commit comments

Comments
 (0)