You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Create your first TypeScript function](https://docs.microsoft.com/azure/azure-functions/create-first-function-vs-code-typescript?pivots=nodejs-model-v3)
20
+
-[Create your first JavaScript function](https://docs.microsoft.com/azure/azure-functions/create-first-function-vs-code-node?pivots=nodejs-model-v3)
15
21
16
-
Prior to version 3.5.0, this package only contained TypeScript type definitions. Starting with version 3.5.0 it _also_ contains the underlying Azure Functions Framework for Node.js. This framework package is included by default in [v4.x of the Azure Functions runtime](https://docs.microsoft.com/azure/azure-functions/functions-versions?pivots=programming-language-javascript), meaning you do _not_ need to include the package in your app. However, there may be cases where you want a specific version of the package, so you can override the default shipped in Azure with the below steps.
22
+
## Considerations
17
23
18
-
### TypeScript:
24
+
- The Node.js "programming model" shouldn't be confused with the Azure Functions "runtime".
25
+
-_**Programming model**_: Defines how you author your code and is specific to JavaScript and TypeScript.
26
+
-_**Runtime**_: Defines underlying behavior of Azure Functions and is shared across all languages.
27
+
- The programming model version is strictly tied to the version of the [`@azure/functions`](https://www.npmjs.com/package/@azure/functions) npm package, and is versioned independently of the [runtime](https://learn.microsoft.com/azure/azure-functions/functions-versions?pivots=programming-language-javascript). Both the runtime and the programming model use "4" as their latest major version, but that is purely a coincidence.
19
28
20
-
For a full tutorial, see [how to create your first TypeScript function](https://docs.microsoft.com/azure/azure-functions/create-first-function-vs-code-typescript).
29
+
## Usage
30
+
31
+
Prior to version 3.5.0, this package only contained TypeScript type definitions. Starting with version 3.5.0 it _also_ contains the underlying Azure Functions Programming Model for Node.js. This package is included by default in [v4.x of the Azure Functions runtime](https://docs.microsoft.com/azure/azure-functions/functions-versions?pivots=programming-language-javascript), meaning you do _not_ need to include the package in your app. However, there may be cases where you want a specific version of the package, so you can override the default shipped in Azure with the below steps.
32
+
33
+
### TypeScript
21
34
22
35
1. Specify a main entrypoint in your package.json
36
+
23
37
```json
24
38
"main": "dist/src/index.js"
25
39
```
40
+
26
41
2. Add the following code to your entrypoint file (e.g. `src/index.ts`):
42
+
27
43
```typescript
28
44
import * as func from '@azure/functions';
29
45
@@ -32,25 +48,22 @@ For a full tutorial, see [how to create your first TypeScript function](https://
32
48
33
49
**IMPORTANT NOTE**: If you only want this package for the TypeScript type definitions, you may list this package in the "devDependencies" section of your package.json. If you are overriding the default shipped in Azure as described above, the package must be listed in the production "dependencies" section of your package.json.
34
50
35
-
For more documentation, see the [TypeScript developer guide](https://docs.microsoft.com/azure/azure-functions/functions-reference-node#typescript).
36
-
37
51
### JavaScript
38
52
39
-
For a full tutorial, see [how to create your first JavaScript function](https://docs.microsoft.com/azure/azure-functions/create-first-function-vs-code-node).
40
-
41
53
1. Specify a main entrypoint in your package.json
54
+
42
55
```json
43
56
"main": "src/index.js"
44
57
```
58
+
45
59
2. Add the following code to your entrypoint file:
60
+
46
61
```javascript
47
62
const func = require('@azure/functions');
48
63
49
64
func.setup();
50
65
```
51
66
52
-
For more documentation, see the [JavaScript developer guide](https://docs.microsoft.com/azure/azure-functions/functions-reference-node).
53
-
54
67
## Contributing
55
68
56
69
- Clone the repository locally and open in VS Code
@@ -61,7 +74,7 @@ For more documentation, see the [JavaScript developer guide](https://docs.micros
61
74
- Create or open a local function app to test with
62
75
- In the local function app:
63
76
- Make sure you are calling `func.setup()` somewhere in your app, as described above in the "Usage" section
64
-
- Run `npm link @azure/functions`. This will point your app to the local repository for the framework package
77
+
- Run `npm link @azure/functions`. This will point your app to the local repository for the `@azure/functions` package
65
78
- Add the following settings to your "local.settings.json" file or configure them directly as environment variables
66
79
- `languageWorkers__node__arguments`: `--inspect`
67
80
> 💡 Tip: Set `logging__logLevel__Worker` to `debug` if you want to view worker-specific logs in the output of `func start`
@@ -75,4 +88,4 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
75
88
76
89
### Contributing to type definitions
77
90
78
-
The type definitions are located in the `types` folder. Please make sure to update the tests in `./test/types/index.test.ts` as well.
91
+
The type definitions are located in the `types` folder. Please make sure to update the tests in `./test/types/index.test.ts` as well.
0 commit comments