<a href="https://github.com/Hexilee/roa/tree/master/examples">Examples</a>
<span> | </span>
<a href="https://github.com/Hexilee/roa/wiki/Guide">Guide</a>
<span> | </span>
<a href="https://github.com/Hexilee/roa/wiki/Cookbook">Cookbook</a>
hyper
, runtime-independent, you can chose async runtime as you like.# Cargo.toml
[dependencies]
roa = "0.5.0"
async-std = { version = "1.5", features = ["attributes"] }
use roa::App;
use roa::preload::*;
use std::error::Error as StdError;
#[async_std::main]
async fn main() -> Result<(), Box<dyn StdError>> {
let app = App::new().end("Hello, World");
app.listen("127.0.0.1:8000", |addr| {
println!("Server is listening on {}", addr)
})?
.await?;
Ok(())
}
Refer to wiki for more details.
PostgreSQL.
http://localhost:8080/json
http://localhost:8080/db
http://localhost:8080/queries?q=20
http://localhost:8080/fortune
http://localhost:8080/updates?q=20
http://localhost:8080/plaintext