Skip to content

Commit 1e89203

Browse files
committed
Make the reqwest/wasm example a little more helpful
1 parent 9480a0e commit 1e89203

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
## Example usage of CLoudEvents sdk/Reqwest from WASM
22

3-
Install the dependencies with:
3+
First, ensure you have [`wasm-pack` installed](https://rustwasm.github.io/wasm-pack/installer/)
4+
5+
Then install the dependencies:
46

57
npm install
68

7-
Then build the example locally with:
9+
And finally run the example:
810

911
npm run serve
1012

11-
and then visiting http://localhost:8080 in a browser should run the example!
13+
You should see a form in your browser at http://localhost:8080. When
14+
the form is submitted, a CloudEvent will be sent to the Target URL,
15+
http://localhost:9000 by default, which is the default URL for the
16+
[actix example](../actix-web-example). Fire it up in another terminal
17+
to verify that the data is successfully sent and received.
18+
19+
Open the javascript console in the browser to see any helpful error
20+
messages.
1221

13-
This example is loosely based off of [this example](https://github.com/rustwasm/wasm-bindgen/blob/master/examples/fetch/src/lib.rs), an example usage of `fetch` from `wasm-bindgen`, and from [reqwest repo](https://github.com/seanmonstar/reqwest/tree/master/examples/wasm_github_fetch).
22+
This example is loosely based off of [this
23+
example](https://github.com/seanmonstar/reqwest/tree/master/examples/wasm_github_fetch).

example-projects/reqwest-wasm-example/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<div class="form-group">
1414
<label class="col-md-4 control-label" for="event_target">Target</label>
1515
<div class="col-md-4">
16-
<input id="event_target" name="event_target" type="text" placeholder="http://localhost:9000" class="form-control input-md" required="">
16+
<input id="event_target" name="event_target" type="text" value="http://localhost:9000" class="form-control input-md" required="">
1717

1818
</div>
1919
</div>
@@ -22,15 +22,15 @@
2222
<div class="form-group">
2323
<label class="col-md-4 control-label" for="event_type">Event Type</label>
2424
<div class="col-md-4">
25-
<input id="event_type" name="event_type" type="text" placeholder="example" class="form-control input-md" required="">
25+
<input id="event_type" name="event_type" type="text" value="example" class="form-control input-md" required="">
2626
</div>
2727
</div>
2828

2929
<!-- Text input-->
3030
<div class="form-group">
3131
<label class="col-md-4 control-label" for="event_datacontenttype">Event Data Content Type</label>
3232
<div class="col-md-4">
33-
<input id="event_datacontenttype" name="event_datacontenttype" type="text" placeholder="application/json" class="form-control input-md" required="">
33+
<input id="event_datacontenttype" name="event_datacontenttype" type="text" value="application/json" class="form-control input-md" required="">
3434
</div>
3535
</div>
3636

@@ -54,4 +54,4 @@
5454
</form>
5555

5656
</body>
57-
</html>
57+
</html>

0 commit comments

Comments
 (0)