In this sample, the expense
Workflow creates the expense (via an activity that POSTs to localhost:3000/create
) and then waits for a Signal to say whether the expense is approved or rejected:
If it's approved, the payment activity is called (which POSTs to localhost:3000/action
), and then the expense's state should be COMPLETED
in localhost:3000/list.
temporal server start-dev
to start Temporal Server.npm install
to install dependencies.npm run start.watch
to start the Worker.npm run server.watch
to start the expense HTTP server.- In another shell, run one of the execute scripts to start a Workflow:
npm run workflow-approve
should print outDone: { status: 'COMPLETED' }
npm run workflow-timeout
should print outDone: { status: 'TIMED_OUT' }