Skip to content

Instantly share code, notes, and snippets.

@sn0wcat
Last active November 27, 2022 05:59
Show Gist options
  • Save sn0wcat/0ec987722f19b936b2ea3b24e3d50a5a to your computer and use it in GitHub Desktop.
Save sn0wcat/0ec987722f19b936b2ea3b24e3d50a5a to your computer and use it in GitHub Desktop.
How to run dapr with NX

How to run dapr with nx

if you want to run a microservice in nx workspace with dapr, rename the serve target to e.g. x-serve target and use nx:run-commands executor to run dapr with the parameter yarn nx run yourproject-name:serve

Here is an example for project called timeline-microservice:

 "x-serve": {
      "executor": "@nrwl/js:node",
      "options": {
        "buildTarget": "timeline-microservice:build"
      },
      "configurations": {
        "production": {
          "buildTarget": "timeline-microservice:build:production"
        }
      }
    },
    "serve": {
      "executor": "nx:run-commands",
      "options": {
        "commands": [
          "dapr run --app-id timeline-microservice --dapr-grpc-port 51002 --app-port 53002 --app-protocol grpc --components-path ./components/ -- yarn nx run timeline-microservice:x-serve"
        ],
        "parallel": false
      }
    },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment