5 releases

0.8.0 Jan 12, 2024
0.1.5 Mar 23, 2024
0.1.4 Feb 21, 2024
0.1.1 Jan 12, 2024

#2142 in Web programming

Download history 10/week @ 2024-01-06 6/week @ 2024-01-13 97/week @ 2024-02-17 27/week @ 2024-02-24 3/week @ 2024-03-02 3/week @ 2024-03-09 152/week @ 2024-03-23 21/week @ 2024-03-30

176 downloads per month

MIT license

265KB
6.5K SLoC

Viz

Fast, robust, flexible, lightweight web framework for Rust

Features

  • Safety #![forbid(unsafe_code)]

  • Lightweight

  • Robust Routing

  • Handy Extractors

  • Simple + Flexible Handler & Middleware

  • Supports Tower Service

Hello Viz

use std::io;
use std::sync::Arc;

use async_net::TcpListener;
use macro_rules_attribute::apply;
use viz_smol::{IntoResponse, Request, Response, Result, Router};

async fn index(_: Request) -> Result<Response> {
    Ok("<h1>Hello, World!</h1>".into_response())
}

#[apply(smol_macros::main!)]
async fn main(ex: &Arc<smol_macros::Executor<'_>>) -> io::Result<()> {
    // Build our application with a route.
    let app = Router::new().get("/", index);

    // Create a `smol`-based TCP listener.
    let listener = TcpListener::bind(("127.0.0.1", 3000)).await.unwrap();
    println!("listening on {}", listener.local_addr().unwrap());

    // Run it
    viz_smol::serve(ex.clone(), listener, app).await
}

More examples can be found here.

Get started

Open Viz.rs, select language or version.

License

This project is licensed under the MIT license.

Author

Dependencies

~10–24MB
~334K SLoC