quickstarts/state_management/javascript/http
Joe Bowbeer 44d7fdcd8c npm audit fixes and lock files
Signed-off-by: Joe Bowbeer <joe.bowbeer@gmail.com>
2024-07-29 00:15:18 +00:00
..
order-processor npm audit fixes and lock files 2024-07-29 00:15:18 +00:00
.gitignore State Management quickstarts examples added. (#528) 2022-02-14 15:57:16 -08:00
README.md Merging `release-1.12` into main branch (#952) 2023-10-13 16:10:27 -07:00
dapr.yaml Merging `release-1.12` into main branch (#952) 2023-10-13 16:10:27 -07:00
makefile Removed docker image prefix addition step 2022-07-25 12:28:57 -07:00

README.md

Dapr state management (HTTP Client)

In this quickstart, you'll create a microservice to demonstrate Dapr's state management API. The service generates messages to store data in a state store. See Why state management to understand when this pattern might be a good choice for your software architecture.

Visit this link for more information about Dapr and State Management.

Note: This example leverages HTTP requests only. If you are looking for the example using the Dapr Client SDK (recommended) click here.

This quickstart includes one service: Node client service order-processor

This section shows how to run applications at once using multi-app run template files with dapr run -f .. This enables to you test the interactions between multiple applications.

Open a new terminal window and run order-processor using the multi app run template defined in dapr.yaml:

  1. Open a new terminal window and navigate to order-processor directory:
  cd ./order-processor
  npm install
  cd ..
  1. Run the Node service app with Dapr:
  dapr run -f .
  1. Stop and cleanup application process
  dapr stop -f .

Run a single app at a time with Dapr (Optional)

An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple dapr run .. -- npm start commands. This next section covers how to do this.

Run Node service with Dapr

  1. Navigate to folder and install dependencies:
  cd ./order-processor
  npm install
  1. Run the Node service app with Dapr:
dapr run --app-id order-processor --resources-path ../../../resources/ -- npm start
  1. Stop and cleanup the process
dapr stop --app-id order-processor