$ npm install @azure/functions
| Branch | Status | Support level | Node.js Versions |
|---|---|---|---|
| v4.x | Preview | 18 | |
| v3.x (default) | GA (Recommended) | 18, 16, 14 |
npm install @azure/functions@preview
AzureWebJobsFeatureFlags to EnableWorkerIndexing. For more information, see Enable v4 programming model.@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.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
});
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}!` };
}
});
npm installnpm run buildnpm linknpm link @azure/functions. This will point your app to the local repository for the @azure/functions packagelanguageWorkers__node__arguments: --inspect
💡 Tip: Set
logging__logLevel__Workertodebugif you want to view worker-specific logs in the output offunc start
func start or press <kbd>F5</kbd>)npm test and fix any issues. If you want to debug the tests, switch your launch profile in VS Code to "Launch Unit Tests" and press <kbd>F5</kbd>.This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
The type definitions are located in the types folder. Please make sure to update the tests in ./test/types/index.test.ts as well.
© 2010 - cnpmjs.org x YWFE | Home | YWFE