Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 925 Bytes

README.md

File metadata and controls

38 lines (26 loc) · 925 Bytes

HTTP server example using the Warp crate

Quickstart with Docker

With an WASI-enabled Docker, you just need one line of command to build and run the HTTP server example. For details, refer to the Dockerfile and docker-compose.yml files.

docker compose build
docker compose run --no-TTY -p 8080:8080 server-warp

Next, you can jump directly to the Test section. If you want to build and run the application step by step on your own system, read on.

Build

cargo build --target wasm32-wasi --release

Run

wasmedge target/wasm32-wasi/release/wasmedge_warp_server.wasm

Test

Run the following from another terminal.

$ curl http://localhost:8080/
Try POSTing data to /echo such as: `curl localhost:8080/echo -XPOST -d 'hello world'`
$ curl http://localhost:8080/echo -X POST -d "WasmEdge"
WasmEdge