diff --git a/viz-smol/README.md b/viz-smol/README.md new file mode 100644 index 00000000..8b48fe06 --- /dev/null +++ b/viz-smol/README.md @@ -0,0 +1,97 @@ +

+ +

+ +

+ Viz +

+ +
+

Fast, robust, flexible, lightweight web framework for Rust

+
+ +
+ + + Safety! + + + Docs.rs docs + + + Crates.io version + + + Download + + + Codecov + + + Discord +
+ +## Features + +- **Safety** `#![forbid(unsafe_code)]` + +- Lightweight + +- Robust `Routing` + +- Handy `Extractors` + +- Simple + Flexible `Handler` & `Middleware` + +- Supports Tower `Service` + +## Hello Viz + +```rust +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 { + Ok("

Hello, World!

".into_response()) +} + +#[apply(smol_macros::main!)] +async fn main(ex: &Arc>) -> 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](https://github.com/viz-rs/viz/tree/main/examples). + +## Get started + +Open [Viz.rs](https://viz.rs), select language or version. + +## License + +This project is licensed under the [MIT license](LICENSE). + +## Author + +- [@fundon@fosstodon.org](https://fosstodon.org/@fundon) + +- [@\_fundon](https://twitter.com/_fundon)