- Install Node 8.0+
$ node -v
v11.1.11
# Need to downgrade node version
$ brew unlink node
$ brew install node@10
$ brew link node@10
$ echo export PATH="/usr/local/opt/node@10/bin:$PATH" > ~/.bashrc
As explain in node version,
8.11.1
and10.14.1
recommended
- Install version 2.x of the Azure Functions Core Tools
# Linux & Windows
$ npm install -g azure-functions-core-tools
# Mac (Use brew, NOT npm)
$ brew tap azure/functions
$ brew install azure-functions-core-tools
$ func init nodejs --worker-runtime node
List all NodeJS functions
$ func templates list
JavaScript Templates:
Azure Blob Storage trigger
Azure Cosmos DB trigger
Durable Functions activity
Durable Functions HTTP starter
Durable Functions orchestrator
Azure Event Grid trigger
Azure Event Hub trigger
HTTP trigger
IoT Hub (Event Hub)
Azure Queue Storage trigger
SendGrid
Azure Service Bus Queue trigger
Azure Service Bus Topic trigger
Timer trigger
Then, create a NodeJS function from templates
# First of all, move to NodeJS functions project top
$ cd nodejs
# Http Trigger functions
$ func new --language JavaScript --template "HTTP trigger" --name HttpTriggerJS
Run the host. This automatically enables debugging with the Node port 5858:
$ func host start
# Test
$ curl --request POST http://localhost:7071/api/HttpTriggerJS --data '{"name":"Azure Rocks"}'
The project needs to be ininitialized by VSCode
- https://code.visualstudio.com/tutorials/functions-extension/create-app
- https://code.visualstudio.com/tutorials/functions-extension/run-app
Local VSCode Configurations:
$ ls -1 .vscode
extensions.json
launch.json
settings.json
tasks.json
Issue: azure functions Mac issue You must have the Azure Functions Core Tools installed to debug your local functions.
brew tap azure/functions
brew install azure-functions-core-tools
brew link azure-functions-core-tools
# To relink
brew unlink azure-functions-core-tools && brew link azure-functions-core-tools