Skip to content

Commit 87189a2

Browse files
committed
Update README instructions
1 parent 443f5ad commit 87189a2

File tree

1 file changed

+68
-5
lines changed

1 file changed

+68
-5
lines changed

README.md

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,84 @@
55
You must have Rust installed to build `ambi_mock_client`.
66
You can find documentation on installing Rust [here](https://www.rust-lang.org/tools/install).
77

8+
You will also need a local copy of [Ambi](https://github.com/jhodapp/ambi) running ( default port 4000 ).
9+
810
### Using cargo run
9-
```Rust
11+
```BASH
1012
> cargo build
1113
> cargo run
12-
{"tempurature":"23.7","humidity":"63.8","pressure":"945","dust_concentration":"999","air_purity":"DANGEROUS"}
14+
15+
Sending POST request to http://localhost:4000/api/readings/add as JSON: {"tempurature":"19.2","humidity":"87.7","pressure":"1074","dust_concentration":"415","air_purity":"DANGEROUS"}
16+
Response: Ok(
17+
Response {
18+
url: Url {
19+
scheme: "http",
20+
cannot_be_a_base: false,
21+
username: "",
22+
password: None,
23+
host: Some(
24+
Domain(
25+
"localhost",
26+
),
27+
),
28+
port: Some(
29+
4000,
30+
),
31+
path: "/api/readings/add",
32+
query: None,
33+
fragment: None,
34+
},
35+
status: 200,
36+
headers: {
37+
"cache-control": "max-age=0, private, must-revalidate",
38+
"content-length": "60",
39+
"content-type": "application/json; charset=utf-8",
40+
"date": "Sat, 22 Jan 2022 19:25:14 GMT",
41+
"server": "Cowboy",
42+
"x-request-id": "FsyuNssWKjhYHbUAAAAj",
43+
},
44+
},
45+
)
1346

1447
# Or just
1548

1649
> cargo run
17-
{"tempurature":"33.5","humidity":"39.6","pressure":"1100","dust_concentration":"8","air_purity":"FRESH_AIR"}
1850
```
1951

2052
### As an executable binary
21-
```Rust
53+
```BASH
2254
> cargo build
2355
> ./target/debug/ambi_mock_client
24-
{"tempurature":"25.9","humidity":"43.4","pressure":"1076","dust_concentration":"322","air_purity":"DANGEROUS"}
56+
57+
Sending POST request to http://localhost:4000/api/readings/add as JSON: {"tempurature":"28.8","humidity":"85.2","pressure":"964","dust_concentration":"930","air_purity":"DANGEROUS"}
58+
Response: Ok(
59+
Response {
60+
url: Url {
61+
scheme: "http",
62+
cannot_be_a_base: false,
63+
username: "",
64+
password: None,
65+
host: Some(
66+
Domain(
67+
"localhost",
68+
),
69+
),
70+
port: Some(
71+
4000,
72+
),
73+
path: "/api/readings/add",
74+
query: None,
75+
fragment: None,
76+
},
77+
status: 200,
78+
headers: {
79+
"cache-control": "max-age=0, private, must-revalidate",
80+
"content-length": "60",
81+
"content-type": "application/json; charset=utf-8",
82+
"date": "Sat, 22 Jan 2022 19:28:08 GMT",
83+
"server": "Cowboy",
84+
"x-request-id": "FsyuX1U1NOj9m7IAAABB",
85+
},
86+
},
87+
)
2588
```

0 commit comments

Comments
 (0)