minor fix (#191)

1. remove unneeded sentence;
2. typos and indention;

Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
This commit is contained in:
Gaojin CAO 2021-07-27 00:08:35 +08:00 committed by GitHub
parent 7de7a96cfe
commit 8615ff9477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 16 deletions

View File

@ -45,7 +45,7 @@ dapr run --app-id example-service \
go run main.go
```
See the [example folder](./example) for more working Dapr client examples.
See the [example folder](./examples) for more working Dapr client examples.
#### Usage
@ -79,7 +79,7 @@ if err := client.DeleteState(ctx, store, "key1"); err != nil {
}
```
For more granular control, the Dapr Go client exposes `SetStateItem` type, which can be use to gain more control over the state operations and allow for multiple items to be saved at once:
For more granular control, the Dapr Go client exposes `SetStateItem` type, which can be used to gain more control over the state operations and allow for multiple items to be saved at once:
```go
item1 := &dapr.SetStateItem{
@ -215,15 +215,15 @@ secret, err := client.GetSecret(ctx, "store-name", "secret-name", opt)
```
#### Authentication
##### Authentication
By default, Dapr relies on the network boundary to limit access to its API. If however the target Dapr API is configured with token-based authentication, users can configure the Go Dapr client with that token in two ways:
##### Environment Variable
###### Environment Variable
If the `DAPR_API_TOKEN` environment variable is defined, Dapr will automatically use it to augment its Dapr API invocations to ensure authentication.
##### Explicit Method
###### Explicit Method
In addition, users can also set the API token explicitly on any Dapr client instance. This approach is helpful in cases when the user code needs to create multiple clients for different Dapr API endpoints.
@ -238,7 +238,7 @@ func main() {
}
```
## Service (callback)
### Service (callback)
In addition to the client capabilities that allow you to call into the Dapr API, the Go SDK also provides `service` package to help you bootstrap Dapr callback services in either gRPC or HTTP. Instructions on how to use it are located [here](./service/Readme.md)

View File

@ -27,13 +27,6 @@ Follow [instructions](https://docs.dapr.io/getting-started/install-dapr/) to dow
## Step 2 - Understand the code
Now that Dapr is set up locally, clone the repo, then navigate to the Hello World SDK quickstart:
```sh
git clone [-b <dapr_version_tag>] https://github.com/dapr/quickstarts.git
cd quickstarts/hello-world-sdk
```
The [order.go](./order.go) is a simple command line application, that implements four commands:
* `put` sends an order with configurable order ID.
* `get` return the current order number.

View File

@ -4,6 +4,10 @@ The `examples/service` folder contains a Dapr enabled `serving` app and a `clien
To run this example, start by first launching the service in either HTTP or gRPC:
### Prepare
- Dapr installed
### HTTP
<!-- STEP
@ -76,7 +80,7 @@ Publish JSON content
```shell
curl -d '{ "from": "John", "to": "Lary", "message": "hi" }' \
-H "Content-type: application/json" \
"http://localhost:3500/v1.0/publish/messages"
"http://localhost:3500/v1.0/publish/messages/topic1"
```
Publish XML content (read as text)
@ -84,7 +88,7 @@ Publish XML content (read as text)
```shell
curl -d '<message><from>John</from><to>Lary</to></message>' \
-H "Content-type: application/xml" \
"http://localhost:3500/v1.0/publish/messages"
"http://localhost:3500/v1.0/publish/messages/topic1"
```
Publish BIN content
@ -92,7 +96,7 @@ Publish BIN content
```shell
curl -d '0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40' \
-H "Content-type: application/octet-stream" \
"http://localhost:3500/v1.0/publish/messages"
"http://localhost:3500/v1.0/publish/messages/topic1"
```
### Service Invocation