Joan Miquel 14b3f9e3a9 [rust] Fix Roa (#8518) 1 year ago
..
src fdfa0962cb [roa] Fix fortunes route (#7337) 3 years ago
templates d7fc507f68 Add rust/roa framework (#5574) 5 years ago
.env d7fc507f68 Add rust/roa framework (#5574) 5 years ago
Cargo.toml d7fc507f68 Add rust/roa framework (#5574) 5 years ago
README.md d7fc507f68 Add rust/roa framework (#5574) 5 years ago
benchmark_config.json fdfa0962cb [roa] Fix fortunes route (#7337) 3 years ago
config.toml 0096f84ee9 Config for the new toolset (#6259) 4 years ago
roa-core.dockerfile 14b3f9e3a9 [rust] Fix Roa (#8518) 1 year ago
roa-diesel.dockerfile 14b3f9e3a9 [rust] Fix Roa (#8518) 1 year ago
roa-pg.dockerfile 14b3f9e3a9 [rust] Fix Roa (#8518) 1 year ago
roa-sqlx.dockerfile 14b3f9e3a9 [rust] Fix Roa (#8518) 1 year ago
roa-tokio.dockerfile 14b3f9e3a9 [rust] Fix Roa (#8518) 1 year ago
roa.dockerfile 14b3f9e3a9 [rust] Fix Roa (#8518) 1 year ago
rustfmt.toml d7fc507f68 Add rust/roa framework (#5574) 5 years ago

README.md

Roa

Roa is an async web framework inspired by koajs, lightweight but powerful.

Stable Test codecov wiki Rust Docs Crate version Download Version

<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>


Feature highlights

  • A lightweight, solid and well extensible core.
    • Supports HTTP/1.x and HTTP/2.0 protocols.
    • Full streaming.
    • Highly extensible middleware system.
    • Based on hyper, runtime-independent, you can chose async runtime as you like.
  • Many useful extensions.
    • Official runtime schemes:
    • Transparent content compression (br, gzip, deflate, zstd).
    • Configurable and nestable router.
    • Named uri parameters(query and router parameter).
    • Cookie and jwt support.
    • HTTPS support.
    • WebSocket support.
    • Asynchronous multipart form support.
    • Other middlewares(logger, CORS .etc).
  • Integrations
  • Works on stable Rust.

Get start

# 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.

Database

PostgreSQL.

Test URLs

Test 1: JSON Encoding

http://localhost:8080/json

Test 2: Single Row Query

http://localhost:8080/db

Test 3: Multi Row Query

http://localhost:8080/queries?q=20

Test 4: Fortunes (Template rendering)

http://localhost:8080/fortune

Test 5: Update Query

http://localhost:8080/updates?q=20

Test 6: Plaintext

http://localhost:8080/plaintext