Make the reqwest/wasm example a little more helpful
This commit is contained in:
parent
9480a0e944
commit
1e89203cbc
|
@ -1,13 +1,23 @@
|
|||
## Example usage of CLoudEvents sdk/Reqwest from WASM
|
||||
|
||||
Install the dependencies with:
|
||||
First, ensure you have [`wasm-pack` installed](https://rustwasm.github.io/wasm-pack/installer/)
|
||||
|
||||
Then install the dependencies:
|
||||
|
||||
npm install
|
||||
|
||||
Then build the example locally with:
|
||||
And finally run the example:
|
||||
|
||||
npm run serve
|
||||
|
||||
and then visiting http://localhost:8080 in a browser should run the example!
|
||||
You should see a form in your browser at http://localhost:8080. When
|
||||
the form is submitted, a CloudEvent will be sent to the Target URL,
|
||||
http://localhost:9000 by default, which is the default URL for the
|
||||
[actix example](../actix-web-example). Fire it up in another terminal
|
||||
to verify that the data is successfully sent and received.
|
||||
|
||||
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).
|
||||
Open the javascript console in the browser to see any helpful error
|
||||
messages.
|
||||
|
||||
This example is loosely based off of [this
|
||||
example](https://github.com/seanmonstar/reqwest/tree/master/examples/wasm_github_fetch).
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="event_target">Target</label>
|
||||
<div class="col-md-4">
|
||||
<input id="event_target" name="event_target" type="text" placeholder="http://localhost:9000" class="form-control input-md" required="">
|
||||
<input id="event_target" name="event_target" type="text" value="http://localhost:9000" class="form-control input-md" required="">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -22,7 +22,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="event_type">Event Type</label>
|
||||
<div class="col-md-4">
|
||||
<input id="event_type" name="event_type" type="text" placeholder="example" class="form-control input-md" required="">
|
||||
<input id="event_type" name="event_type" type="text" value="example" class="form-control input-md" required="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="event_datacontenttype">Event Data Content Type</label>
|
||||
<div class="col-md-4">
|
||||
<input id="event_datacontenttype" name="event_datacontenttype" type="text" placeholder="application/json" class="form-control input-md" required="">
|
||||
<input id="event_datacontenttype" name="event_datacontenttype" type="text" value="application/json" class="form-control input-md" required="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue