write-model
The write-model exports two functions repositoryBuilder and commandServiceBuilder.
To initialize the model, you pass an adapter and reducer to the repositoryBuilder to generate a repository. Then you pass the repository and actions to the commandServiceBuilder to generate a list of commands

Example

readModel.js
1
const {
2
repositoryBuilder,
3
commandServiceBuilder,
4
} = require('serverless-cqrs.write-mode')
5
6
const adapter = require('./adapter')
7
const reducer = require('./reducer')
8
const actions = require('./actions')
9
10
const repository = repositoryBuilder.build({
11
adapter,
12
reducer,
13
})
14
15
module.exports = commandServiceBuilder.build({
16
repository,
17
actions,
18
})
Copied!
Last modified 2yr ago
Copy link
Contents
Example