Marla - Async Web Server Framework for Rust

Marla is a handler and middleware based web server framework for Rust.

Handlers can be called based on static path maps, regex based paths, and fully custom router functions.

Middleware can be configured to run for all requests by default and overridden for specific routes.

Production Readiness / Stability

Not yet recommended for production use. Not guaranteed to ever be ready.

Example

Cargo.toml: toml hyper = { version = "0.14", features = ["full"] } macro_rules_attribute = "0.0" marla = "0.1.0-alpha.0" regex = "1.4" tokio = { version = "1.0", features = ["full"] }

main.rs: ```rust use std::collections::HashMap; use std::net::SocketAddr;

use hyper::{Body, Method, Response}; use macrorulesattribute::macrorulesattribute; use marla::{Request, serve, async_handler}; use marla::config::{MarlaConfig, RegexPath, Route}; use regex::Regex;

[tokio::main]

async fn main() { let marla_config = MarlaConfig {

    regex_path_routes: vec![
        RegexPath{
            regex: Regex::new("^/hello/([a-zA-Z]{1,30})$").unwrap(),
            routes: vec![
                (Method::GET, Route { handler: hello, middleware: None }),
            ].into_iter().collect()
        },
    ],

    static_path_routes: HashMap::new(),
    router: None,
    middleware: vec![],
    listen_addr: SocketAddr::from(([127, 0, 0, 1], 3000)),
};

serve(marla_config, ()).await;

}

[macrorulesattribute(async_handler!)]

pub async fn hello( request: Request, body: Option, _bundle: (), ) -> Response { Response::new(Body::from(format!("Hello, {}\n", request.pathparams[0]))) } ```

Features

Future Enhancements