@azure/functions
TypeScript icon, indicating that this package has built-in type declarations

4.6.0 • Public • Published

Azure Functions Node.js Programming Model

Branch Status Support level Node.js Versions
v4.x (default) Build Status Test Status GA 20, 18
v3.x Build Status Test Status GA 20, 18

Install

npm install @azure/functions

Documentation

Considerations

  • The Node.js "programming model" shouldn't be confused with the Azure Functions "runtime".
    • Programming model: Defines how you author your code and is specific to JavaScript and TypeScript.
    • Runtime: Defines underlying behavior of Azure Functions and is shared across all languages.
  • The programming model version is strictly tied to the version of the @azure/functions npm package, and is versioned independently of the runtime. Both the runtime and the programming model use "4" as their latest major version, but that is purely a coincidence.
  • You can't mix the v3 and v4 programming models in the same function app. As soon as you register one v4 function in your app, any v3 functions registered in function.json files are ignored.

Usage

TypeScript

import { app, HttpRequest, HttpResponseInit, InvocationContext } from "@azure/functions";

export async function httpTrigger1(request: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
    context.log(`Http function processed request for url "${request.url}"`);

    const name = request.query.get('name') || await request.text() || 'world';

    return { body: `Hello, ${name}!` };
};

app.http('httpTrigger1', {
    methods: ['GET', 'POST'],
    authLevel: 'anonymous',
    handler: httpTrigger1
});

JavaScript

const { app } = require('@azure/functions');

app.http('httpTrigger1', {
    methods: ['GET', 'POST'],
    authLevel: 'anonymous',
    handler: async (request, context) => {
        context.log(`Http function processed request for url "${request.url}"`);

        const name = request.query.get('name') || await request.text() || 'world';

        return { body: `Hello, ${name}!` };
    }
});

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.5.0-alpha.50next
2.0.0-beta.00beta
4.6.094,561latest
4.0.0-alpha.131,762preview

Version History

VersionDownloads (Last 7 Days)Published
4.6.094,561
4.5.140,081
4.5.012,825
4.4.02,165
4.3.05,216
4.2.01,968
4.1.02,545
4.0.11,872
4.0.0789
4.0.0-alpha.131,762
4.0.0-alpha.120
4.0.0-alpha.12.20230912.45
4.0.0-alpha.11252
4.0.0-alpha.10153
3.5.1105,442
4.0.0-alpha.952
4.0.0-alpha.80
4.0.0-alpha.70
4.0.0-alpha.60
3.5.02,583
4.0.0-alpha.50
3.5.0-alpha.50
4.0.0-alpha.40
3.5.0-alpha.40
4.0.0-alpha.30
4.0.0-alpha.20
4.0.0-alpha.10
3.5.0-alpha.30
3.5.0-alpha.20
3.5.0-alpha.10
3.2.02,417
3.1.00
3.0.02,852
2.0.01,251
2.0.0-beta.00
1.2.318,167
1.2.27,246
1.2.0751
1.0.34,707
1.0.2-beta214
1.0.2-beta10
1.0.1-beta281
1.0.1-beta10

Package Sidebar

Install

npm i @azure/functions

Weekly Downloads

309,757

Version

4.6.0

License

MIT

Unpacked Size

616 kB

Total Files

76

Last publish

Collaborators

  • gaaguiar
  • victoriahall
  • anatolib
  • pgopa
  • paulbatum
  • facavalcante
  • ahmelsayed
  • mahoeger