Skip to content

Commit

Permalink
docs: add Deno reducer example (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobressan authored Dec 15, 2023
1 parent 75b990c commit 99fb564
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Summary

- [Introduction](./introduction.md)
- [Reducers](./reducers/README.md)
- [Deno](./reducers/deno.md)
3 changes: 3 additions & 0 deletions book/src/reducers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Reducers

- [Deno](deno.md): custom reducers in js
29 changes: 29 additions & 0 deletions book/src/reducers/deno.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Deno

With the deno reducer is possible to create a custom reducer for logics that the builtin reducers don't have support. This reducer is only enable with the deno feature on build.

## Configuration

Example of a configuration

```toml
[reducer]
type = "Deno"
main_module = "./examples/deno/enrich.js"
use_async = true
```

### Section: `reducer`

- `type`: the literal value `Deno`.
- `main_module`: the js file with the reducer logic
- `use_async`: run the js in async mode


## Run code

To run the code with the deno will be necessary to use deno feature

```sh
cargo run --features=deno -- daemon --config ./examples/deno/enrich.js
```

0 comments on commit 99fb564

Please sign in to comment.