JavaScript | Durable Functions
This quickstart demonstrates Durable Functions with JavaScript (Node.js v4 programming model) using the Durable Task Scheduler backend. It includes two patterns:
- Function Chaining — An orchestration that calls three "say hello" activities sequentially
- Fan-out/Fan-in — An orchestration that greets multiple cities in parallel and aggregates results
- Node.js 18+
- Azure Functions Core Tools v4
- Docker (for the emulator)
-
Start the emulator:
docker run -d -p 8080:8080 -p 8082:8082 mcr.microsoft.com/dts/dts-emulator:latest
-
Install dependencies and run:
cd samples/durable-functions/javascript/HelloCities npm install func start -
Trigger the function chaining orchestration:
curl -X POST http://localhost:7071/api/StartChaining
-
Trigger the fan-out/fan-in orchestration:
curl -X POST http://localhost:7071/api/StartFanOutFanIn
-
View in the dashboard: http://localhost:8082
The chaining orchestration greets Tokyo, Seattle, and London sequentially:
["Hello Tokyo!", "Hello Seattle!", "Hello London!"]The fan-out/fan-in orchestration greets all five cities in parallel and returns combined results.