#http #web #framework #async

roa

async web framework inspired by koajs, lightweight but powerful

3 releases (breaking)

✓ Uses Rust 2018 edition

0.4.0 Feb 14, 2020
0.3.0 Feb 14, 2020
0.2.0 Feb 6, 2020

#163 in HTTP server

MIT license

235KB
4K SLoC

Roa

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

Build status codecov Rust Docs Crate version Download Version License: MIT

Examples | Guide | Cookbook


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 and async-std, runtime-independent, you can chose any async runtime you like.
  • Many useful extensions and middlewares.
    • Transparent content compression (br, gzip, deflate, zstd).
    • Configurable and nestable router.
    • Named uri parameters(query and router parameter).
    • Cookie and jwt support.
    • Integration with serde and askama. JSON, urlencoded form, html template support.
    • Other middlewares(logger, CORS .etc).
  • Works on stable Rust.

Next step

  • Streaming multipart form support.
  • ORM integration.
  • Websocket support.
  • HTTPS support.

Get start

# Cargo.toml

[dependencies]
roa = "0.3"
async-std = { version = "1.4", features = ["attributes"] }
// main.rs

use roa::core::App;
use roa::preload::*;
use std::error::Error as StdError;

#[async_std::main]
async fn main() -> Result<(), Box<dyn StdError>> {
    let mut app = App::new(());
    app.end(|ctx| async move {
        ctx.write_text("Hello, World").await
    });
    app.listen("127.0.0.1:8000", |addr| {
        println!("Server is listening on {}", addr)
    })?
    .await?;
    Ok(())
}

Dependencies

~8–13MB
~279K SLoC