WASM
WebAssembly is a way to safely run code compiled in other languages. Runtimes execute WebAssembly Modules (Wasm), which are most often binaries with a extension.
The Wasm HTTP middleware allows you to rewrite a request URI with custom logic compiled to a Wasm binary. In other words, you can extend Dapr using external files that are not pre-compiled into the binary. Dapr embeds to accomplish this without CGO.
Minimally, a user must specify a Wasm binary that contains the custom logic used to rewrite requests. An instance of the Wasm binary is not safe to use concurrently. The below configuration fields control both the binary to instantiate and how large an instance pool to use. A larger pool allows higher concurrency while consuming more memory.
To be applied, the middleware must be referenced in . See middleware pipelines.
To compile your Wasm, you must compile source using a waPC guest SDK such as TinyGo.
Here’s an example in TinyGo: