viz 0.2.4

Fast, flexible, minimalist web framework for Rust
Documentation

Features

  • Safety #![forbid(unsafe_code)]

  • Lightweight

  • Robust Routing

  • Handy Extractors

  • Simple + Flexible Handler & Middleware

Hello Viz

use std::net::SocketAddr;
use viz::{get, Request, Result, Router, Server, ServiceMaker};

async fn index(_: Request) -> Result<&'static str> {
    Ok("Hello Viz")
}

#[tokio::main]
async fn main() -> Result<()> {
    let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
    println!("listening on {}", addr);

    let app = Router::new().route("/", get(index));

    if let Err(err) = Server::bind(&addr)
        .serve(ServiceMaker::from(app))
        .await
    {
        println!("{}", err);
    }

    Ok(())
}

More examples can be found here.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Viz by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.