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

1.2.0 • Public • Published

Type definitions for Azure Functions

This package contains type definitions for using TypeScript with Azure Functions.

These typings are for common objects that will be passed to your Azure Functions function code. Azure Functions supports TypeScript development, but does not support directly running TypeScript code without transpilation.

Read more on configuring entry points in your Azure Functions function app.

Install

Because this package only contains TypeScript type definitions, it should be saved under devDependencies.

npm install @azure/functions --save-dev

Usage

import { AzureFunction, Context, HttpRequest } from "@azure/functions";

const index: AzureFunction = async function (context: Context, req: HttpRequest) {
    context.log('JavaScript HTTP trigger function processed a request.');
    if (req.query.name || (req.body && req.body.name)) {
        context.res = {
            status: "200",
            body: "Hello " + (req.query.name || req.body.name)
        };
    } else {
        context.res = {
            status: 400,
            body: "Please pass a name on the query string or in the request body"
        };
    }
}

export { index };

Versions

Versioning of @azure/functions is tied to the version of the Azure Functions Node.js Worker the types were generated from. You can find the Azure Functions Node.js Worker version of a given Function Runtime Version here. It is recommended that you take the latest version available.

Getting Started with Azure Functions

If you are getting started with Azure Functions, you can follow this tutorial to create and deploy your first JavaScript function. We recommend that you use Visual Studio Code and the Azure Functions extension.

The Azure Functions developer guide and the JavaScript-specific developer guide are good resources to gain an understanding of more Azure Functions concepts.

Package Sidebar

Install

npm i @azure/functions@1.2.0

Version

1.2.0

License

MIT

Unpacked Size

10.1 kB

Total Files

3

Last publish

Collaborators

  • erijiz
  • anatolib
  • pgopa
  • paulbatum
  • facavalcante
  • ahmelsayed
  • mahoeger