Skip to content

Commit

Permalink
refactor(web-kv): reorganize and add README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <[email protected]>
  • Loading branch information
rvolosatovs committed Nov 7, 2024
1 parent 5774e2a commit eb2a536
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 32 deletions.
60 changes: 30 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions examples/web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# `wasi-keyvalue` in the Web

This example shows a Web app using `wasi:keyvalue` implementation provided by the server via WebTransport using wRPC.

The server acts as both a direct implementor of `wasi:keyvalue` and a "proxy", which can delegate `wasi:keyvalue` calls issued by the Web client to other `wasi:keyvalue` implementations via various transports supported by wRPC.

## Runing

With `cargo`:

```
cargo run -p wasi-keyvalue-web
```

## `wasi-keyvalue` plugins

To invoke other wRPC `wasi:keyvalue` plugins in "proxy" mode, for example TCP, try:

```
cargo run -p wasi-keyvalue-tcp-server
```

And select `wRPC/TCP` as the protocol in the UI
2 changes: 1 addition & 1 deletion examples/web/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "web-rust-keyvalue"
name = "wasi-keyvalue-web"
version = "0.1.0"

authors.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion examples/web/rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ async fn main() -> anyhow::Result<()> {
.context("failed to query WebTransport socket address")?;
let port = ep_addr.port();

let index = get(Html(include_str!("../index.html")));
let index = get(Html(include_str!("../../ui/index.html")));
let http = axum::serve(
lis,
Router::new()
Expand Down
File renamed without changes.

0 comments on commit eb2a536

Please sign in to comment.