docs: WebAssembly page and Wasmer Wasix example [skip ci]
https://static-web-server.net/features/webassembly/
Diff
docs/content/download-and-install.md | 8 ++++++++
docs/content/features/webassembly.md | 22 ++++++++++++++++++++++
docs/mkdocs.yml | 1 +
3 files changed, 31 insertions(+)
@@ -70,6 +70,14 @@ Via [Scoop](https://scoop.sh/)
scoop install static-web-server
```
### WebAssembly
Via [Wasmer](https://wasmer.io/wasmer/static-web-server/)
```sh
wasmer run wasmer/static-web-server --net --enable-threads --mapdir /public:/my/host/dir -- --port 8787
```
### TrueNAS SCALE
If you use [TrueNAS SCALE](https://www.truenas.com/truenas-scale/) then visit [TrueCharts Community Website](https://truecharts.org/charts/stable/static-web-server/) and its [Introduction to SCALE](https://truecharts.org/manual/SCALE/guides/scale-intro) page to install SWS application in your instance.
@@ -0,0 +1,22 @@
# WebAssembly
**SWS** can run in a [WebAssembly](https://webassembly.org/) context.
!!! info "Wasm/Wasix targets are not officially supported by SWS yet"
We do not officially support Wasm or Wasix targets yet. But SWS project will eventually support Wasix as a target in a not remote future.<br>
In the meantime, [Wasmer](https://wasmer.io/) folks made it possible to [run SWS via Wasix today](https://wasmer.io/posts/announcing-wasix) via a series of patches.
## Wasix
You can run SWS using [The Wasmer Runtime](https://wasmer.io/wasmer/static-web-server/) with [Wasix](https://wasix.org/). See the [wasmer/static-web-server](https://wasmer.io/wasmer/static-web-server) package.
To run SWS, make sure to install Wasmer first and then enable its `net` and `threads` features as well as map your host directory via the `mapdir` option before starting the server.
Here is an example.
```sh
wasmer run wasmer/static-web-server \
--net --enable-threads --mapdir /public:/my/host/dir -- --port 8787
```
See [The WASIX with Axum Tutorial](https://wasix.org/docs/language-guide/rust/tutorials/wasix-axum) for more details.
@@ -163,6 +163,7 @@ nav:
- 'Ignore Files': 'features/ignore-files.md'
- 'Health endpoint': 'features/health-endpoint.md'
- 'Virtual Hosting': 'features/virtual-hosting.md'
- 'WebAssembly': 'features/webassembly.md'
- 'Platforms & Architectures': 'platforms-architectures.md'
- 'Migrating from v1 to v2': 'migration.md'
- 'Changelog v2 (stable)': 'https://github.com/static-web-server/static-web-server/blob/master/CHANGELOG.md'