We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 190b3c5 commit f5b428eCopy full SHA for f5b428e
README.md
@@ -57,17 +57,18 @@ async-std = { version = "1.5", features = ["attributes"] }
57
```
58
59
```rust
60
-use roa::App;
+use roa::{App, Context};
61
use roa::preload::*;
62
use std::error::Error as StdError;
63
+async fn hello(ctx: &mut Context<()>) -> roa::Result {
64
+ ctx.resp.write_text("Hello, World");
65
+ Ok(())
66
+}
67
+
68
69
#[async_std::main]
70
async fn main() -> Result<(), Box<dyn StdError>> {
- let mut app = App::new(());
- app.end(|mut ctx| async move {
- ctx.resp_mut().write("Hello, World");
- Ok(())
- });
71
+ let app = App::new(()).end(hello);
72
app.listen("127.0.0.1:8000", |addr| {
73
println!("Server is listening on {}", addr)
74
})?
0 commit comments