This is an example of a simple function app written in TypeScript. Most of the contents come from default templates that are available through both the VS Code extension for Azure Functions and Azure Functions Core Tools. The
HelloWorldNpm function is modified from a default template to import and use an npm module.
- Install latest Active LTS version of Node.js
- Install latest azure-functions-core-tools if you do not already have it.
npm install -g azure-functions-core-tools
npm installfrom project root to install dev dependencies.
To build this Function app run
npm run build. (Note that
npm start and
F5 already include a build step.) If you are using binding extensions, the necessary binaries are also installed.
dist, as configured in
outDir. We don't advise changing this configuration. The default
To run your code, use
npm start. If you are using VS Code, you can press
F5 to build and run instead.
This command builds your Function app and starts the Azure Functions host to run your code. If you only want to run your built code, you can run
func start or
npm run start:host.
npm run test can be implemented to test your code. To ignore specific files and folders when deploying, add them to
To prepare your function app for deployment, use
npm run build:production. If you are using VS Code, deploy by clicking
Deploy to Function App. If you already have a deployed Function app in Azure and want to update its contents, you can also use
func azure functionapp publish <FunctionAppName>.