Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace CURL inputs with JS code samples #2138

Merged
merged 17 commits into from
Nov 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Review FAQ
  • Loading branch information
EugeniyBurmistrov committed Nov 18, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 0a592189e6fbbb4afd182c3d5c95e8e46e6c11c1
31 changes: 1 addition & 30 deletions docs/faq.md
Original file line number Diff line number Diff line change
@@ -24,39 +24,10 @@ View Models are a Redux-specific extension to these mechanisms. View models are
**A**: Implement a [custom Read Model](read-side.md#custom-read-models). Custom Read Models allow you to use custom logic to communicate with a Read Model store.

EugeniyBurmistrov marked this conversation as resolved.
Show resolved Hide resolved
**Q**: How to send an aggregate command?<br/>
EugeniyBurmistrov marked this conversation as resolved.
Show resolved Hide resolved
**A**: To send a command from a client browser, use the [standard HTTP API](frontend.md#http-api): <br/>

```
$ curl -X POST "http://localhost:3000/api/commands"
--header "Content-Type: application/json" \
--data '
{
"aggregateName":"Todo",
"type":"createItem",
"aggregateId":"root-id",
"payload": {
"id":`date +%s`,
"text":"Learn reSolve API"
}
}
```
**A**: To send a command from a client browser, use the reSolve HTTP API or one of the available client libraries. Refer to the [Frontend](frontend.md) article for more information.

On the server side, you can [send a command](api/saga.md#executecommand) from an API Handler or Saga:

<!-- prettier-ignore-start -->

[mdis]:# (../tests/saga-sample/saga.js#execute)
```js
await sideEffects.executeCommand({
aggregateName: 'User',
aggregateId: event.aggregateId,
type: 'requestConfirmUser',
payload: event.payload,
})
```

<!-- prettier-ignore-end -->

**Q**: How to perform validation to ensure input values are unique?<br/>
EugeniyBurmistrov marked this conversation as resolved.
Show resolved Hide resolved
**A**: In a distributed application, it is not possible to perform reliable checks. You should detect value duplicates in a Read Model or Saga projection code and mark duplicated values as incorrect.

EugeniyBurmistrov marked this conversation as resolved.
Show resolved Hide resolved