9 releases
0.8.0 |
|
---|---|
0.1.9 | Jun 23, 2024 |
0.1.6 | May 28, 2024 |
0.1.5 | Mar 23, 2024 |
0.1.1 | Jan 12, 2024 |
#721 in HTTP server
687 downloads per month
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–21MB
~319K SLoC