@@ -14,43 +14,58 @@ The following HTTP routes are available from the component:
1414/sleep # Sleep for {ms} milliseconds
1515/echo # Echo the HTTP body
1616/echo-headers # Echo the HTTP headers
17- /echo-trailers # Echo the HTTP trailers
18- /upload # Echo uploaded blob
17+ /upload # Echo uploaded blob
18+ ```
19+
20+ Testing routes:
21+
22+ ``` bash
23+ # Hello world
24+ $ curl localhost:8080
25+ # Sleep for {ms} milliseconds
26+ $ curl localhost:8080/sleep/2000
27+ # Echo the HTTP body
28+ $ curl -d " Test echo body" localhost:8080/echo
29+ # Echo the HTTP headers
30+ $ curl -H " X-Test-Header: 123" localhost:8080/echo-headers
31+ # Echo uploaded blob
32+ $ echo " Hello World!" > test_file.txt
33+ $ curl -H " Content-Type: text/plain" --data-binary @test_file.txt http://localhost:8080/upload
1934```
2035
2136## Quick Start
22- The project uses [ ` Wasmtime ` ] [ wasmtime ] as its runtime. However, if needed, it
23- can easily be adjusted to use [ ` jco ` ] [ jco ] instead. For ` wasmtime ` installation,
37+ The project uses [ ` Wasmtime ` ] [ wasmtime ] as its runtime. However, if needed, it
38+ can easily be adjusted to use [ ` jco ` ] [ jco ] instead. For ` wasmtime ` installation,
2439simply run:
2540
2641``` bash
2742$ curl https://wasmtime.dev/install.sh -sSf | bash
2843```
2944
30- The quickest way to start is by using [ ` just ` ] [ just ] .
45+ The quickest way to start is by using [ ` just ` ] [ just ] .
3146``` bash
3247$ just serve # to build and serve the wasm component on `localhost:8080`
33- $ curl 127.0.0.1 :8080 # to send requests to component.
48+ $ curl localhost :8080 # to send requests to component.
3449```
3550
3651Alternatively, run:
3752
3853``` bash
3954$ npm install
40- $ npm build
55+ $ npm run build
4156$ wasmtime serve -S common dist/server.component.wasm
4257```
4358
4459## See Also
4560
46- - [ sample-wasi-http-rust] ( https://github.com/bytecodealliance/sample-wasi-http- rust) An example ` wasi:http ` server component written in Rust.
61+ - [ sample-wasi-http-rust] [ rust-sample ] An example ` wasi:http ` server component written in Rust.
4762
4863## License
4964
5065Apache-2.0 with LLVM Exception
5166
5267[ jco ] : https://github.com/bytecodealliance/jco
5368[ just ] : https://github.com/casey/just
54- [ rust-sample] : https://github.com/bytecodealliance/sample-wasi-http-rust
69+ [ rust-sample ] : https://github.com/bytecodealliance/sample-wasi-http-rust
5570[ wasi-http ] : https://github.com/WebAssembly/wasi-http
56- [ wasmtime] : https://wasmtime.dev/
71+ [ wasmtime ] : https://wasmtime.dev/
0 commit comments