quickstarts service invocation code fix (#2867)

Signed-off-by: rogerogers <rogers@rogerogers.com>

Signed-off-by: rogerogers <rogers@rogerogers.com>
This commit is contained in:
copy rogers 2022-10-08 08:56:01 +08:00 committed by GitHub
parent 52267b2105
commit 1aa50d9d1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -56,7 +56,7 @@ pip3 install -r requirements.txt
Run the `order-processor` service alongside a Dapr sidecar. Run the `order-processor` service alongside a Dapr sidecar.
```bash ```bash
dapr run --app-port 7001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- python3 app.py dapr run --app-port 8001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- python3 app.py
``` ```
> **Note**: Since Python3.exe is not defined in Windows, you may need to use `python app.py` instead of `python3 app.py`. > **Note**: Since Python3.exe is not defined in Windows, you may need to use `python app.py` instead of `python3 app.py`.
@ -70,7 +70,7 @@ def getOrder():
'ContentType': 'application/json'} 'ContentType': 'application/json'}
app.run(port=7001) app.run(port=8001)
``` ```
### Step 4: Run `checkout` service ### Step 4: Run `checkout` service
@ -221,8 +221,8 @@ let axiosConfig = {
"dapr-app-id": "order-processor" "dapr-app-id": "order-processor"
} }
}; };
const res = await axios.post(`${DAPR_HOST}:${DAPR_HTTP_PORT}/orders`, order , axiosConfig); const res = await axios.post(`${DAPR_HOST}:${DAPR_HTTP_PORT}/orders`, order , axiosConfig);
console.log("Order passed: " + res.config.data); console.log("Order passed: " + res.config.data);
``` ```
### Step 5: View the Service Invocation outputs ### Step 5: View the Service Invocation outputs
@ -535,13 +535,13 @@ cd service_invocation/go/http/order-processor
Install the dependencies: Install the dependencies:
```bash ```bash
go build go build app.go
``` ```
Run the `order-processor` service alongside a Dapr sidecar. Run the `order-processor` service alongside a Dapr sidecar.
```bash ```bash
dapr run --app-port 6001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- go run dapr run --app-port 6001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- go run app.go
``` ```
Each order is received via an HTTP POST request and processed by the Each order is received via an HTTP POST request and processed by the
@ -554,6 +554,7 @@ func getOrder(w http.ResponseWriter, r *http.Request) {
log.Fatal(err) log.Fatal(err)
} }
log.Printf("Order received : %s", string(data)) log.Printf("Order received : %s", string(data))
}
``` ```
### Step 4: Run `checkout` service ### Step 4: Run `checkout` service