Fast, robust, flexible, lightweight web framework for Rust
-
Safety
#![forbid(unsafe_code)]
-
Lightweight
-
Robust
Routing
-
Handy
Extractors
-
Simple + Flexible
Handler
&Middleware
use std::net::SocketAddr;
use viz::{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().get("/", index);
if let Err(err) = Server::bind(&addr)
.serve(ServiceMaker::from(app))
.await
{
println!("{err}");
}
Ok(())
}
More examples can be found here.
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
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.