vial
is a small web "framework" for making small web "sites".
It includes but a droplet of the bare minimum:
Everything else... well, that's up to you.
The goal is a small, simple, as-few-as-possible-dependencies web library you can use to test out an idea quickly or get a static site rolling. Single file, server side apps? Yes, please!
It's sort of like a picnic where the playlist is all 90s music and you have to bring your own beverage. Yabba dabba doo!
As is tradition... the bare minimum:
```rust use vial::vial;
vial! { GET "/" => |_| "Hello, world!".into(); }
fn main() { if let Err(e) = vial::run!("0.0.0.0:7667") { eprintln!("error: {}", e); } } ```
For a bit more sanity, you can route to functions directly:
```rust use vial::{vial, Request, Response};
vial! { GET "/hi/world" => |_| "Hello, world!".into(); GET "/" => echo; }
fn echo(req: Request) -> Response { Response::from( format!("You said: {}", req.params("echo").unwrap()) ) }
fn main() { if let Err(e) = vial::run!("0.0.0.0:7667") { eprintln!("error: {}", e); } } ```
vial doesn't come with JSON or a template engine or any of that fancy stuff, but there are a few compile-time features you can activate for enhanced productivity:
to_json
and from_json
powers, via Serde.before_filter
after_filter