Skip to content

Commit 9788a0f

Browse files
committed
add a usage example to readme
1 parent 4bef000 commit 9788a0f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@
2020
$ cargo add -D tide-testing
2121
```
2222

23+
## Example usage:
24+
25+
```rust
26+
use tide::prelude::*;
27+
let mut app = tide::new();
28+
app.at("/").get(|_| async { Ok("hello!") });
29+
30+
use tide_testing::TideTestingExt;
31+
assert_eq!(app.get("/").recv_string().await?, "hello!");
32+
assert_eq!(
33+
app.post("/missing").await?.status(),
34+
tide::http::StatusCode::NotFound
35+
);
36+
```
2337

2438
## Cargo Features:
2539

0 commit comments

Comments
 (0)